-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyA-syntaxextArea: Syntax extensionsArea: Syntax extensionsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Description
Working on #6993 specifically on #12179 raised the fact that break
and continue
use Name
as opposed of Ident
. This was introduced in #9103 and unfortunately this change seems to have made them non-hygienic.
An example taken from @huonw comment:
#[feature(macro_rules)];
macro_rules! foo {
($e: expr) => {
// $e shouldn't be able to interact with this 'x
'x: loop { $e }
}
}
fn main() {
'x: loop {
// i.e. this 'x should refer to the outer loop, but may be "captured"
// by the 'x declaration inside foo
foo!(break 'x);
println!("should not be printed")
}
}
Presumably, reverting the change should make them hygienic again.
I volunteer as a mentor for this fix.
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyA-syntaxextArea: Syntax extensionsArea: Syntax extensionsE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.