continue
expressions in loop conditions
#118673
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
C-bug
Category: This is a bug.
I-lang-radar
Items that are on lang's radar and will need eventual work or consideration.
T-lang
Relevant to the language team
Uh oh!
There was an error while loading. Please reload this page.
Location
https://doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions
Summary
The reference unambiguously states that "A continue expression is only permitted in the body of a loop.", but this is demonstrably not true for
continue 'label
expressions.The following compiles and runs an infinite loop. A warning mentions the body being unreachable, but otherwise the behavior is as one would expect:
Meanwhile, the following does not compile:
In the second example, an error is generated:
Furthermore,
rustc --explain E0590
demonstrates label usage with abreak
expression:Unless I have misunderstood something, there seems to be conflicting information between the reference and the actual behavior of the compiler.
Edit: grammar.
The text was updated successfully, but these errors were encountered: