-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser: suggest quotes only for ident attribute values #124512
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
r? diagnostics |
This needs a test @rustbot author |
ef15235
to
ea04951
Compare
When encountering code like: ``` #[cfg(key = ["foo", "bar"])] fn main() {} ``` the parser incorrectly suggests: ``` error: expected unsuffixed literal, found `[` --> ../pg/src/main.rs:1:13 | 1 | #[cfg(key = ["foo", "bar"])] | ^ | help: surround the identifier with quotation marks to parse it as a string | 1 | #[cfg(key =" "["foo", "bar"])] | + + error: aborting due to 1 previous error ``` This commit modifies the parser to check if an attribute value is an ident before suggesting.
Added a test. @compiler-errors |
Could not assign reviewer from: |
☔ The latest upstream changes (presumably #124972) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing as this has been fixed by 0ad3c5d. |
When encountering code like:
the parser incorrectly suggests:
This commit modifies the parser to check if an attribute value is an ident before suggesting.