mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 13:02:50 +00:00
Refactor 'diving_in loop internals in prepare_vtable_segments
Less explicit loops -- easier to read.
This commit is contained in:
parent
f8f5d7aab2
commit
364fc444a5
@ -126,24 +126,24 @@ fn prepare_vtable_segments_inner<'tcx, T>(
|
|||||||
pred.subst_supertrait(tcx, &inner_most_trait_ref).as_trait_clause()
|
pred.subst_supertrait(tcx, &inner_most_trait_ref).as_trait_clause()
|
||||||
});
|
});
|
||||||
|
|
||||||
'diving_in_skip_visited_traits: loop {
|
// Find an unvisited supertrait
|
||||||
if let Some(next_super_trait) = direct_super_traits_iter.next() {
|
match direct_super_traits_iter
|
||||||
if visited.insert(next_super_trait.to_predicate(tcx)) {
|
.find(|&super_trait| visited.insert(super_trait.to_predicate(tcx)))
|
||||||
// We're throwing away potential constness of super traits here.
|
{
|
||||||
// FIXME: handle ~const super traits
|
// Push it to the stack for the next iteration of 'diving_in to pick up
|
||||||
let next_super_trait = next_super_trait.map_bound(|t| t.trait_ref);
|
Some(unvisited_super_trait) => {
|
||||||
stack.push((
|
// We're throwing away potential constness of super traits here.
|
||||||
next_super_trait,
|
// FIXME: handle ~const super traits
|
||||||
emit_vptr_on_new_entry,
|
let next_super_trait = unvisited_super_trait.map_bound(|t| t.trait_ref);
|
||||||
Some(direct_super_traits_iter),
|
stack.push((
|
||||||
));
|
next_super_trait,
|
||||||
break 'diving_in_skip_visited_traits;
|
emit_vptr_on_new_entry,
|
||||||
} else {
|
Some(direct_super_traits_iter),
|
||||||
continue 'diving_in_skip_visited_traits;
|
))
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break 'diving_in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There are no more unvisited direct super traits, dive-in finished
|
||||||
|
None => break 'diving_in,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user