@@ -346,9 +346,10 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
346
346
let substd_type_param_defs = m. generics . type_param_defs . subst ( tcx, & substs) ;
347
347
new_type_param_defs. push_all ( * substd_type_param_defs) ;
348
348
349
- debug ! ( "static method %s type_param_defs=%s substs=%s" ,
349
+ debug ! ( "static method %s type_param_defs=%s ty=%s, substs=%s" ,
350
350
m. def_id. repr( tcx) ,
351
351
new_type_param_defs. repr( tcx) ,
352
+ ty. repr( tcx) ,
352
353
substs. repr( tcx) ) ;
353
354
354
355
tcx. tcache . insert ( m. def_id ,
@@ -893,8 +894,8 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
893
894
}
894
895
ast:: item_trait( ref generics, _, ref trait_methods) => {
895
896
let _trait_def = trait_def_of_item ( ccx, it) ;
896
- ensure_trait_methods ( ccx, it. id ) ;
897
897
898
+ // Run convert_methods on the provided methods.
898
899
let ( _, provided_methods) =
899
900
split_trait_methods ( * trait_methods) ;
900
901
let untransformed_rcvr_ty = ty:: mk_self ( tcx, local_def ( it. id ) ) ;
@@ -904,6 +905,11 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
904
905
untransformed_rcvr_ty,
905
906
& ty_generics, generics,
906
907
it. vis ) ;
908
+
909
+ // We need to do this *after* converting methods, since
910
+ // convert_methods produces a tcache entry that is wrong for
911
+ // static trait methods. This is somewhat unfortunate.
912
+ ensure_trait_methods ( ccx, it. id ) ;
907
913
}
908
914
ast:: item_struct( struct_def, ref generics) => {
909
915
ensure_no_ty_param_bounds ( ccx, it. span , generics, "structure" ) ;
0 commit comments