@@ -126,24 +126,24 @@ fn prepare_vtable_segments_inner<'tcx, T>(
126
126
pred. subst_supertrait ( tcx, & inner_most_trait_ref) . as_trait_clause ( )
127
127
} ) ;
128
128
129
- ' diving_in_skip_visited_traits: loop {
130
- if let Some ( next_super_trait) = direct_super_traits_iter. next ( ) {
131
- if visited. insert ( next_super_trait. to_predicate ( tcx) ) {
132
- // We're throwing away potential constness of super traits here.
133
- // FIXME: handle ~const super traits
134
- let next_super_trait = next_super_trait. map_bound ( |t| t. trait_ref ) ;
135
- stack. push ( (
136
- next_super_trait,
137
- emit_vptr_on_new_entry,
138
- Some ( direct_super_traits_iter) ,
139
- ) ) ;
140
- break ' diving_in_skip_visited_traits;
141
- } else {
142
- continue ' diving_in_skip_visited_traits;
143
- }
144
- } else {
145
- break ' diving_in;
129
+ // Find an unvisited supertrait
130
+ match direct_super_traits_iter
131
+ . find ( |& super_trait| visited. insert ( super_trait. to_predicate ( tcx) ) )
132
+ {
133
+ // Push it to the stack for the next iteration of 'diving_in to pick up
134
+ Some ( unvisited_super_trait) => {
135
+ // We're throwing away potential constness of super traits here.
136
+ // FIXME: handle ~const super traits
137
+ let next_super_trait = unvisited_super_trait. map_bound ( |t| t. trait_ref ) ;
138
+ stack. push ( (
139
+ next_super_trait,
140
+ emit_vptr_on_new_entry,
141
+ Some ( direct_super_traits_iter) ,
142
+ ) )
146
143
}
144
+
145
+ // There are no more unvisited direct super traits, dive-in finished
146
+ None => break ' diving_in,
147
147
}
148
148
}
149
149
0 commit comments