Skip to content

Commit

Permalink
Only use a single loop over the associated types
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jul 5, 2023
1 parent 243687a commit 3219993
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_hir_analysis/src/astconv/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// So every `Projection` clause is an `Assoc = Foo` bound. `associated_types` contains all associated
// types's `DefId`, so the following loop removes all the `DefIds` of the associated types that have a
// corresponding `Projection` clause
for (projection_bound, span) in &projection_bounds {
for def_ids in associated_types.values_mut() {
for def_ids in associated_types.values_mut() {
for (projection_bound, span) in &projection_bounds {
let def_id = projection_bound.projection_def_id();
def_ids.remove(&def_id);
if tcx.generics_require_sized_self(def_id) {
Expand All @@ -232,9 +232,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
);
}
}
}

for def_ids in associated_types.values_mut() {
// If the associated type has a `where Self: Sized` bound, we do not need to constrain the associated
// type in the `dyn Trait`.
def_ids.retain(|def_id| !tcx.generics_require_sized_self(def_id));
Expand Down

0 comments on commit 3219993

Please sign in to comment.