-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Make brackets optional for single attributes #484
Make brackets optional for single attributes #484
Conversation
I also don’t see the point in keeping the That said, I do like |
I also don't understand why everyone thinks that |
I'm mostly thinking of Objective-C, which uses The main example I had in mind for Rust was some kind of generalized smart pointer sugar, where I have a hard time imagining that
That's the only reason. An earlier push to remove the brackets foundered on trying to remove the |
Regardless of the the choice between |
Not so fast: Rust allows one to stick a hashbang in the first line of a file and have it Just Work as it does in shell scripts. Are we certain that this RFC would still allow us to parse that unambiguously? If that issue is resolved, then I'd be fine with this (though if possible I'd rather go the extra mile and remove the brackets entirely, rather than merely let them be optional). It's not the |
Hash bangs are not really an issue: They start with the same prefix as inner attributes, but we can just define the parser to ignore the first line if it has a leading |
On the drawback part, I'd state it make two differents syntax for the same thing. |
Wouldn't this mean every crate root file using an inner attribute would need to start with a blank line or comment? Seems problematic. |
Why do we care about shabang support in rust files? Does anyone actually use it? Actually, how would you even use it? |
@sfackler Eventually we main gain a |
We could just change the syntax for an outer attribute, maybe |
In any case, this RFC won't affect shebang disambiguation, since they're required to be absolute paths, and |
Oh, true. We could just check for |
But inner attr
|
Why couldn't |
I believe we special case the first token in a file (maybe in a crate?) |
We discussed this at the triage meeting. It generally looks like an improvement, but has the same ambiguity problems as #483 and is churn at this late stage. Thanks for writing the RFC! |
This is an alternative to #483: instead of changing attributes to
@
, just make the brackets optional for#
.Note that I'm not opposed to #483, and am only presenting this as an alternative to consider, although I have a slight preference for it. From a practical perspective, it has the benefit of being backwards compatible.
Splicing in my comment from the other RFC:
CLICKME