diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /compiler/rustc_trait_selection/src/traits/util.rs | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/util.rs')
-rw-r--r-- | compiler/rustc_trait_selection/src/traits/util.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 0f5dff01c..ed47d2f83 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -5,8 +5,8 @@ use smallvec::SmallVec; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def_id::DefId; -use rustc_middle::ty::subst::{GenericArg, Subst, SubstsRef}; use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable}; +use rustc_middle::ty::{GenericArg, SubstsRef}; use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext}; pub use rustc_infer::traits::{self, util::*}; @@ -268,10 +268,7 @@ pub fn count_own_vtable_entries<'tcx>( tcx: TyCtxt<'tcx>, trait_ref: ty::PolyTraitRef<'tcx>, ) -> usize { - let existential_trait_ref = - trait_ref.map_bound(|trait_ref| ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)); - let existential_trait_ref = tcx.erase_regions(existential_trait_ref); - tcx.own_existential_vtable_entries(existential_trait_ref).len() + tcx.own_existential_vtable_entries(trait_ref.def_id()).len() } /// Given an upcast trait object described by `object`, returns the @@ -282,15 +279,10 @@ pub fn get_vtable_index_of_object_method<'tcx, N>( object: &super::ImplSourceObjectData<'tcx, N>, method_def_id: DefId, ) -> Option<usize> { - let existential_trait_ref = object - .upcast_trait_ref - .map_bound(|trait_ref| ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)); - let existential_trait_ref = tcx.erase_regions(existential_trait_ref); - // Count number of methods preceding the one we are selecting and // add them to the total offset. if let Some(index) = tcx - .own_existential_vtable_entries(existential_trait_ref) + .own_existential_vtable_entries(object.upcast_trait_ref.def_id()) .iter() .copied() .position(|def_id| def_id == method_def_id) |