Skip to content

syntax::parse::attr implementation disagrees with BNF in manual #13825

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

Closed
dcrewi opened this issue Apr 28, 2014 · 6 comments · Fixed by #14043
Closed

syntax::parse::attr implementation disagrees with BNF in manual #13825

dcrewi opened this issue Apr 28, 2014 · 6 comments · Fixed by #14043
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST P-low Low priority

Comments

@dcrewi
Copy link
Contributor

dcrewi commented Apr 28, 2014

According to the manual, multiple comma-separated attributes may be specified within a single pair of square brackets. The parser does not do this at present (02ba8e2). Which one is correct?

Use case:

#[inline, cfg(target_word_size = "32")]
fn assert_fits_in_machine_word() {/*...*/}
#[inline, cfg(target_word_size = "64")]
fn assert_fits_in_machine_word() {/*...*/}
@alexcrichton
Copy link
Member

I believe the manual is correct in this case, that looks like it should be a valid attribute.

@huonw
Copy link
Member

huonw commented Apr 29, 2014

But, which is the behaviour we want?

@dcrewi
Copy link
Contributor Author

dcrewi commented Apr 30, 2014

Yes, I could imagine either scheme becoming blessed as the preferred style, so I feel this needs more discussion if it hasn't already been decided. Either way, there will need to be a test to preserve the preferred style in the future.

@alexcrichton
Copy link
Member

Nominating.

@pnkfelix
Copy link
Member

pnkfelix commented May 1, 2014

Not a 1.0 milestone issue, Asssigning P-low.

@pnkfelix pnkfelix added P-low and removed I-nominated labels May 1, 2014
@brson
Copy link
Contributor

brson commented May 1, 2014

IMO, we should not accept a comma in attributes. We never used that feature, I've long wanted to remove it, and didn't realize that it was broken.

bors added a commit that referenced this issue May 9, 2014
Attribute grammar in reference manual allowed `#[foo, bar]`, which does not match parser behavior.

Also rename nonterminals to match parser code.

Fix #13825.
arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
…back, r=Veykril

feat: Add `unqualify_method_call` assist

...which is the inverse of `qualify_method_call` assist.

![Peek 2022-12-22 22-47](https://user-images.githubusercontent.com/38225716/209206554-8f067206-6fa6-48f8-849e-f6d36ee2e5a1.gif)

Optional future work:
- import the trait if needed
- remove excess references when auto-ref is possible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The lexing & parsing of Rust source code to an AST P-low Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants