summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2023-06-13 11:46:40 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2023-06-13 11:46:40 +0000
commit5008a08acf6d3e8e01e6b1768850579da6058aea (patch)
tree2e60b942d3ecd56c302ed410f8811ad4b38a109c /compiler/rustc_interface/src
parentf2545fb22554eb1b04528d490c681e583fdc31d0 (diff)
downloadrust-5008a08acf6d3e8e01e6b1768850579da6058aea.tar.gz
rust-5008a08acf6d3e8e01e6b1768850579da6058aea.zip
Simplify code as suggested by the review
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs21
1 files changed, 6 insertions, 15 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index be6bd913790..d61f2d0668a 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -918,24 +918,15 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
                     }
 
                     traits::vtable::VtblSegment::TraitOwnEntries { trait_ref, emit_vptr } => {
-                        let existential_trait_ref = trait_ref.map_bound(|trait_ref| {
-                            ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
-                        });
-
                         // Lookup the shape of vtable for the trait.
                         let own_existential_entries =
-                            tcx.own_existential_vtable_entries(existential_trait_ref.def_id());
-
-                        let own_entries = own_existential_entries.iter().copied().map(|_def_id| {
-                            // The original code here ignores the method if its predicates are impossible.
-                            // We can't really do that as, for example, all not trivial bounds on generic
-                            // parameters are impossible (since we don't know the parameters...),
-                            // see the comment above.
-
-                            1
-                        });
+                            tcx.own_existential_vtable_entries(trait_ref.def_id());
 
-                        unupcasted_cost += own_entries.sum::<usize>();
+                        // The original code here ignores the method if its predicates are impossible.
+                        // We can't really do that as, for example, all not trivial bounds on generic
+                        // parameters are impossible (since we don't know the parameters...),
+                        // see the comment above.
+                        unupcasted_cost += own_existential_entries.len();
 
                         if emit_vptr {
                             upcast_cost += 1;