@@ -22,10 +22,6 @@ use rustc_span::def_id::DefId;
2222
2323use crate :: traits:: normalize:: { normalize_with_depth, normalize_with_depth_to} ;
2424use 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- } ;
2925use crate :: traits:: {
3026 ImplDerivedCause , ImplSource , ImplSourceUserDefinedData , Normalized , Obligation ,
3127 ObligationCause , PolyTraitObligation , PredicateObligation , Selection , SelectionError ,
@@ -689,13 +685,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
689685
690686 debug ! ( ?nested, "object nested obligations" ) ;
691687
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) )
699689 }
700690
701691 fn confirm_fn_pointer_candidate (
@@ -1125,36 +1115,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11251115 ) ?
11261116 . expect ( "did not expect ambiguity during confirmation" ) ;
11271117
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) )
11581119 }
11591120
11601121 fn confirm_builtin_unsize_candidate (
0 commit comments