@@ -195,7 +195,7 @@ use rustc::hir::map as hir_map;
195195use rustc:: hir:: def_id:: DefId ;
196196use rustc:: middle:: lang_items:: { ExchangeMallocFnLangItem } ;
197197use rustc:: traits;
198- use rustc:: ty:: subst:: { Substs , Subst } ;
198+ use rustc:: ty:: subst:: Substs ;
199199use rustc:: ty:: { self , TypeFoldable , TyCtxt } ;
200200use rustc:: ty:: adjustment:: CustomCoerceUnsized ;
201201use rustc:: mir:: { self , Location } ;
@@ -304,6 +304,7 @@ fn collect_roots<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
304304 scx. tcx ( ) . hir . krate ( ) . visit_all_item_likes ( & mut visitor) ;
305305 }
306306
307+ roots. retain ( |root| root. is_instantiable ( scx. tcx ( ) ) ) ;
307308 roots
308309}
309310
@@ -937,14 +938,9 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(scx: &SharedCrateContext<'a, '
937938 let instance =
938939 monomorphize:: resolve ( scx, method. def_id , callee_substs) ;
939940
940- let predicates = tcx. predicates_of ( instance. def_id ( ) ) . predicates
941- . subst ( tcx, instance. substs ) ;
942- if !traits:: normalize_and_test_predicates ( tcx, predicates) {
943- continue ;
944- }
945-
946- if should_trans_locally ( tcx, & instance) {
947- output. push ( create_fn_trans_item ( instance) ) ;
941+ let trans_item = create_fn_trans_item ( instance) ;
942+ if trans_item. is_instantiable ( tcx) && should_trans_locally ( tcx, & instance) {
943+ output. push ( trans_item) ;
948944 }
949945 }
950946 }
0 commit comments