Skip to content

Commit 7d0a5c3

Browse files
yeet upcast_trait_def_id from ImplSourceObjectData
1 parent 42571c4 commit 7d0a5c3

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

compiler/rustc_middle/src/traits/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ impl<'tcx, N> ImplSource<'tcx, N> {
703703
ImplSource::Param(n, ct) => ImplSource::Param(n.into_iter().map(f).collect(), ct),
704704
ImplSource::Builtin(n) => ImplSource::Builtin(n.into_iter().map(f).collect()),
705705
ImplSource::Object(o) => ImplSource::Object(ImplSourceObjectData {
706-
upcast_trait_def_id: o.upcast_trait_def_id,
707706
vtable_base: o.vtable_base,
708707
nested: o.nested.into_iter().map(f).collect(),
709708
}),
@@ -750,9 +749,6 @@ pub struct ImplSourceTraitUpcastingData<N> {
750749
#[derive(PartialEq, Eq, Clone, TyEncodable, TyDecodable, HashStable, Lift)]
751750
#[derive(TypeFoldable, TypeVisitable)]
752751
pub struct ImplSourceObjectData<N> {
753-
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
754-
pub upcast_trait_def_id: DefId,
755-
756752
/// The vtable is formed by concatenating together the method lists of
757753
/// the base object trait and all supertraits, pointers to supertrait vtable will
758754
/// be provided when necessary; this is the start of `upcast_trait_ref`'s methods

compiler/rustc_middle/src/traits/structural_impls.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceObjectData<N> {
4646
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4747
write!(
4848
f,
49-
"ImplSourceObjectData(upcast={:?}, vtable_base={}, nested={:?})",
50-
self.upcast_trait_def_id, self.vtable_base, self.nested
49+
"ImplSourceObjectData(vtable_base={}, nested={:?})",
50+
self.vtable_base, self.nested
5151
)
5252
}
5353
}

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
651651
(unnormalized_upcast_trait_ref, ty::Binder::dummy(object_trait_ref)),
652652
);
653653

654-
Ok(ImplSourceObjectData {
655-
upcast_trait_def_id: upcast_trait_ref.def_id(),
656-
vtable_base,
657-
nested,
658-
})
654+
Ok(ImplSourceObjectData { vtable_base, nested })
659655
}
660656

661657
fn confirm_fn_pointer_candidate(

compiler/rustc_trait_selection/src/traits/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub fn get_vtable_index_of_object_method<'tcx, N>(
248248
) -> Option<usize> {
249249
// Count number of methods preceding the one we are selecting and
250250
// add them to the total offset.
251-
tcx.own_existential_vtable_entries(object.upcast_trait_def_id)
251+
tcx.own_existential_vtable_entries(tcx.parent(method_def_id))
252252
.iter()
253253
.copied()
254254
.position(|def_id| def_id == method_def_id)

0 commit comments

Comments
 (0)