@@ -1136,44 +1136,5 @@ pub fn typeid_for_instance<'tcx>(
1136
1136
bug ! ( "typeid_for_instance: couldn't get fn_abi of instance {:?}" , instance)
1137
1137
} ) ;
1138
1138
1139
- // If this instance is a method and self is a reference, get the impl it belongs to
1140
- let impl_def_id = tcx. impl_of_method ( instance. def_id ( ) ) ;
1141
- if impl_def_id. is_some ( ) && !fn_abi. args . is_empty ( ) && fn_abi. args [ 0 ] . layout . ty . is_ref ( ) {
1142
- // If this impl is not an inherent impl, get the trait it implements
1143
- if let Some ( trait_ref) = tcx. impl_trait_ref ( impl_def_id. unwrap ( ) ) {
1144
- // Transform the concrete self into a reference to a trait object
1145
- let existential_predicate = trait_ref. map_bound ( |trait_ref| {
1146
- ty:: ExistentialPredicate :: Trait ( ty:: ExistentialTraitRef :: erase_self_ty (
1147
- tcx, trait_ref,
1148
- ) )
1149
- } ) ;
1150
- let existential_predicates = tcx. mk_poly_existential_predicates ( & [ ty:: Binder :: dummy (
1151
- existential_predicate. skip_binder ( ) ,
1152
- ) ] ) ;
1153
- // Is the concrete self mutable?
1154
- let self_ty = if fn_abi. args [ 0 ] . layout . ty . is_mutable_ptr ( ) {
1155
- Ty :: new_mut_ref (
1156
- tcx,
1157
- tcx. lifetimes . re_erased ,
1158
- Ty :: new_dynamic ( tcx, existential_predicates, tcx. lifetimes . re_erased , ty:: Dyn ) ,
1159
- )
1160
- } else {
1161
- Ty :: new_imm_ref (
1162
- tcx,
1163
- tcx. lifetimes . re_erased ,
1164
- Ty :: new_dynamic ( tcx, existential_predicates, tcx. lifetimes . re_erased , ty:: Dyn ) ,
1165
- )
1166
- } ;
1167
-
1168
- // Replace the concrete self in an fn_abi clone by the reference to a trait object
1169
- let mut fn_abi = fn_abi. clone ( ) ;
1170
- // HACK(rcvalle): It is okay to not replace or update the entire ArgAbi here because the
1171
- // other fields are never used.
1172
- fn_abi. args [ 0 ] . layout . ty = self_ty;
1173
-
1174
- return typeid_for_fnabi ( tcx, & fn_abi, options) ;
1175
- }
1176
- }
1177
-
1178
1139
typeid_for_fnabi ( tcx, fn_abi, options)
1179
1140
}
0 commit comments