-
Notifications
You must be signed in to change notification settings - Fork 970
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEgood first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors
Description
Rust playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=051766b3584e787d3abab1d2f18424bb
The following code:
'r#if: {
break 'r#if;
}when run through either stable or nightly rustfmt will incorrectly be formatted into this:
'r#if: {
break 'if;
}which rustc will complain because 'if is an invalid label name:
error: invalid label name `'if`
--> src/main.rs:5:15
|
5 | break 'if;
| ^^^Note that this still does occur if the label name is not a keyword:
'r#a: {
break 'r#a;
}is formatted into
'r#a: {
break 'a;
}However this does not cause an error.
Versions of rustfmt (from rust-playground)
1.8.0-stable (2024-11-26 90b35a6239)
and
1.8.0-nightly (2024-11-30 7442931d49)
Metadata
Metadata
Assignees
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEgood first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributors