@@ -15,8 +15,8 @@ use rustc_span::hygiene::DesugaringKind;
1515use rustc_span:: { BytePos , Span } ;
1616
1717use crate :: errors:: {
18- BreakInsideClosure , BreakInsideCoroutine , BreakNonLoop , ContinueLabeledBlock , OutsideLoop ,
19- OutsideLoopSuggestion , UnlabeledCfInWhileCondition , UnlabeledInLabeledBlock ,
18+ BreakInsideClosure , BreakInsideCoroutine , BreakNonLoop , OutsideLoop , OutsideLoopSuggestion ,
19+ UnlabeledCfInWhileCondition , UnlabeledInLabeledBlock ,
2020} ;
2121
2222#[ derive( Clone , Copy , Debug , PartialEq ) ]
@@ -266,13 +266,9 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
266266 self . require_label_in_labeled_block ( e. span , & destination, "continue" ) ;
267267
268268 match destination. target_id {
269- Ok ( loop_id) => {
270- if let Node :: Block ( block) = self . tcx . hir_node ( loop_id) {
271- self . sess . dcx ( ) . emit_err ( ContinueLabeledBlock {
272- span : e. span ,
273- block_span : block. span ,
274- } ) ;
275- }
269+ Ok ( _loop_id) => {
270+ // We have already insured that the loop exists while lowering the ast.
271+ // See `compiler/rustc_ast_lowering/src/expr.rs::LoweringContext::lower_expr_mut`
276272 }
277273 Err ( hir:: LoopIdError :: UnlabeledCfInWhileCondition ) => {
278274 self . sess . dcx ( ) . emit_err ( UnlabeledCfInWhileCondition {
0 commit comments