@@ -523,7 +523,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
523523 let ty = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
524524 self . param_substs ,
525525 & ty) ;
526- let ty = self . scx . tcx ( ) . erase_regions ( & ty ) ;
526+ assert ! ( ty . is_normalized_for_trans ( ) ) ;
527527 let ty = glue:: get_drop_glue_type ( self . scx . tcx ( ) , ty) ;
528528 self . output . push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
529529 }
@@ -859,6 +859,7 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
859859 & callee_substs) ;
860860
861861 let trait_ref = ty:: Binder ( rcvr_substs. to_trait_ref ( tcx, trait_id) ) ;
862+ let trait_ref = tcx. normalize_associated_type ( & trait_ref) ;
862863 let vtbl = fulfill_obligation ( scx, DUMMY_SP , trait_ref) ;
863864
864865 // Now that we know which impl is being used, we can dispatch to
@@ -992,11 +993,8 @@ fn create_fn_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
992993 let concrete_substs = monomorphize:: apply_param_substs ( tcx,
993994 param_substs,
994995 & fn_substs) ;
995- let concrete_substs = tcx. erase_regions ( & concrete_substs) ;
996-
997- let trans_item =
998- TransItem :: Fn ( Instance :: new ( def_id, concrete_substs) ) ;
999- return trans_item;
996+ assert ! ( concrete_substs. is_normalized_for_trans( ) ) ;
997+ TransItem :: Fn ( Instance :: new ( def_id, concrete_substs) )
1000998}
1001999
10021000/// Creates a `TransItem` for each method that is referenced by the vtable for
@@ -1034,10 +1032,14 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(scx: &SharedCrateContext<'a,
10341032 } else {
10351033 None
10361034 }
1037- } )
1038- . collect :: < Vec < _ > > ( ) ;
1035+ } ) ;
1036+
1037+ output. extend ( items) ;
10391038
1040- output. extend ( items. into_iter ( ) ) ;
1039+ // Also add the destructor
1040+ let dg_type = glue:: get_drop_glue_type ( scx. tcx ( ) ,
1041+ trait_ref. self_ty ( ) ) ;
1042+ output. push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( dg_type) ) ) ;
10411043 }
10421044 _ => { /* */ }
10431045 }
@@ -1234,7 +1236,7 @@ pub enum TransItemState {
12341236}
12351237
12361238pub fn collecting_debug_information ( scx : & SharedCrateContext ) -> bool {
1237- return scx . sess ( ) . opts . cg . debug_assertions == Some ( true ) &&
1239+ return cfg ! ( debug_assertions) &&
12381240 scx. sess ( ) . opts . debugging_opts . print_trans_items . is_some ( ) ;
12391241}
12401242
0 commit comments