Skip to content

Commit 5008a08

Browse files
committed
Simplify code as suggested by the review
1 parent f2545fb commit 5008a08

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

compiler/rustc_interface/src/passes.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -918,24 +918,15 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
918918
}
919919

920920
traits::vtable::VtblSegment::TraitOwnEntries { trait_ref, emit_vptr } => {
921-
let existential_trait_ref = trait_ref.map_bound(|trait_ref| {
922-
ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
923-
});
924-
925921
// Lookup the shape of vtable for the trait.
926922
let own_existential_entries =
927-
tcx.own_existential_vtable_entries(existential_trait_ref.def_id());
928-
929-
let own_entries = own_existential_entries.iter().copied().map(|_def_id| {
930-
// The original code here ignores the method if its predicates are impossible.
931-
// We can't really do that as, for example, all not trivial bounds on generic
932-
// parameters are impossible (since we don't know the parameters...),
933-
// see the comment above.
934-
935-
1
936-
});
923+
tcx.own_existential_vtable_entries(trait_ref.def_id());
937924

938-
unupcasted_cost += own_entries.sum::<usize>();
925+
// The original code here ignores the method if its predicates are impossible.
926+
// We can't really do that as, for example, all not trivial bounds on generic
927+
// parameters are impossible (since we don't know the parameters...),
928+
// see the comment above.
929+
unupcasted_cost += own_existential_entries.len();
939930

940931
if emit_vptr {
941932
upcast_cost += 1;

0 commit comments

Comments
 (0)