In order to future-proof potential future changes to the language, I am currently planning to add a static check to the compiler that will reject code that uses the same label multiple times within a single function body.
(The motivation for this is to future-proof support for using such labels as a way to identify code-extents explicitly, for use with a &'a expr
expression form; currently borrow-expressions cannot be given an explicit lifetime, but that may change in the future.)
In particular, code like this will start to be rejected at compile-time:
fn foo() {
'a: while test() {
'a: loop { ... more stuff ... }
...
}
}
while code like this will continue to be accepted:
fn bar() {
'a: while test() {
fn baz() { 'a: loop { ... more stuff ... } }
...
}
}
This is obviously a breaking change. My hope is that it will not break too much code, but I have not yet attempted to evaluate the actual scope of the breakage.
If you have a strong opinion on the matter, feel free to voice it here.
See also discussion here, which documents my original (less aggressive) block-local plan for change here, and the problem with that plan: