@@ -523,7 +523,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
523
523
let ty = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
524
524
self . param_substs ,
525
525
& ty) ;
526
- let ty = self . scx . tcx ( ) . erase_regions ( & ty ) ;
526
+ assert ! ( ty . is_normalized_for_trans ( ) ) ;
527
527
let ty = glue:: get_drop_glue_type ( self . scx . tcx ( ) , ty) ;
528
528
self . output . push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
529
529
}
@@ -859,6 +859,7 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
859
859
& callee_substs) ;
860
860
861
861
let trait_ref = ty:: Binder ( rcvr_substs. to_trait_ref ( tcx, trait_id) ) ;
862
+ let trait_ref = tcx. normalize_associated_type ( & trait_ref) ;
862
863
let vtbl = fulfill_obligation ( scx, DUMMY_SP , trait_ref) ;
863
864
864
865
// 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>,
992
993
let concrete_substs = monomorphize:: apply_param_substs ( tcx,
993
994
param_substs,
994
995
& 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) )
1000
998
}
1001
999
1002
1000
/// 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,
1034
1032
} else {
1035
1033
None
1036
1034
}
1037
- } )
1038
- . collect :: < Vec < _ > > ( ) ;
1035
+ } ) ;
1036
+
1037
+ output. extend ( items) ;
1039
1038
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) ) ) ;
1041
1043
}
1042
1044
_ => { /* */ }
1043
1045
}
@@ -1234,7 +1236,7 @@ pub enum TransItemState {
1234
1236
}
1235
1237
1236
1238
pub fn collecting_debug_information ( scx : & SharedCrateContext ) -> bool {
1237
- return scx . sess ( ) . opts . cg . debug_assertions == Some ( true ) &&
1239
+ return cfg ! ( debug_assertions) &&
1238
1240
scx. sess ( ) . opts . debugging_opts . print_trans_items . is_some ( ) ;
1239
1241
}
1240
1242
0 commit comments