Skip to content

Commit 3219993

Browse files
committed
Only use a single loop over the associated types
1 parent 243687a commit 3219993

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/rustc_hir_analysis/src/astconv/object_safety.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
219219
// So every `Projection` clause is an `Assoc = Foo` bound. `associated_types` contains all associated
220220
// types's `DefId`, so the following loop removes all the `DefIds` of the associated types that have a
221221
// corresponding `Projection` clause
222-
for (projection_bound, span) in &projection_bounds {
223-
for def_ids in associated_types.values_mut() {
222+
for def_ids in associated_types.values_mut() {
223+
for (projection_bound, span) in &projection_bounds {
224224
let def_id = projection_bound.projection_def_id();
225225
def_ids.remove(&def_id);
226226
if tcx.generics_require_sized_self(def_id) {
@@ -232,9 +232,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
232232
);
233233
}
234234
}
235-
}
236-
237-
for def_ids in associated_types.values_mut() {
238235
// If the associated type has a `where Self: Sized` bound, we do not need to constrain the associated
239236
// type in the `dyn Trait`.
240237
def_ids.retain(|def_id| !tcx.generics_require_sized_self(def_id));

0 commit comments

Comments
 (0)