@@ -22,10 +22,6 @@ use rustc_span::def_id::DefId;
22
22
23
23
use crate :: traits:: normalize:: { normalize_with_depth, normalize_with_depth_to} ;
24
24
use crate :: traits:: util:: { self , closure_trait_ref_and_return_type} ;
25
- use crate :: traits:: vtable:: {
26
- count_own_vtable_entries, prepare_vtable_segments, vtable_trait_first_method_offset,
27
- VtblSegment ,
28
- } ;
29
25
use crate :: traits:: {
30
26
ImplDerivedCause , ImplSource , ImplSourceUserDefinedData , Normalized , Obligation ,
31
27
ObligationCause , PolyTraitObligation , PredicateObligation , Selection , SelectionError ,
@@ -689,13 +685,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
689
685
690
686
debug ! ( ?nested, "object nested obligations" ) ;
691
687
692
- let vtable_base = vtable_trait_first_method_offset (
693
- tcx,
694
- unnormalized_upcast_trait_ref,
695
- ty:: Binder :: dummy ( object_trait_ref) ,
696
- ) ;
697
-
698
- Ok ( ImplSource :: Builtin ( BuiltinImplSource :: Object { vtable_base : vtable_base } , nested) )
688
+ Ok ( ImplSource :: Builtin ( BuiltinImplSource :: Object ( index) , nested) )
699
689
}
700
690
701
691
fn confirm_fn_pointer_candidate (
@@ -1125,36 +1115,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1125
1115
) ?
1126
1116
. expect ( "did not expect ambiguity during confirmation" ) ;
1127
1117
1128
- let vtable_segment_callback = {
1129
- let mut vptr_offset = 0 ;
1130
- move |segment| {
1131
- match segment {
1132
- VtblSegment :: MetadataDSA => {
1133
- vptr_offset += TyCtxt :: COMMON_VTABLE_ENTRIES . len ( ) ;
1134
- }
1135
- VtblSegment :: TraitOwnEntries { trait_ref, emit_vptr } => {
1136
- vptr_offset += count_own_vtable_entries ( tcx, trait_ref) ;
1137
- if trait_ref == unnormalized_upcast_principal {
1138
- if emit_vptr {
1139
- return ControlFlow :: Break ( Some ( vptr_offset) ) ;
1140
- } else {
1141
- return ControlFlow :: Break ( None ) ;
1142
- }
1143
- }
1144
-
1145
- if emit_vptr {
1146
- vptr_offset += 1 ;
1147
- }
1148
- }
1149
- }
1150
- ControlFlow :: Continue ( ( ) )
1151
- }
1152
- } ;
1153
-
1154
- let vtable_vptr_slot =
1155
- prepare_vtable_segments ( tcx, source_principal, vtable_segment_callback) . unwrap ( ) ;
1156
-
1157
- Ok ( ImplSource :: Builtin ( BuiltinImplSource :: TraitUpcasting { vtable_vptr_slot } , nested) )
1118
+ Ok ( ImplSource :: Builtin ( BuiltinImplSource :: TraitUpcasting , nested) )
1158
1119
}
1159
1120
1160
1121
fn confirm_builtin_unsize_candidate (
0 commit comments