Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue: RFC 2103 - attributes for tools #44690
Comments
This comment has been minimized.
This comment has been minimized.
|
As mentioned on the Gitter chat, I'm willing to take a try at this! Should just need pointed in the right direction :) |
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov I suspect you'd be the best one to write up some mentoring instructions here. Any chance you can put some thought into it? |
This comment has been minimized.
This comment has been minimized.
|
I'll definitely be getting myself familiar with the parser and AST in the mean time, so no big rush! |
This comment has been minimized.
This comment has been minimized.
|
OK, since @petrochenkov has been busy, let me take a shot at some notes. Perhaps he can correct me if he thinks things could be done a better way. To start, the structure that represents attributes in the AST is called Basically, the model is this: within the AST, an attribute is just a token tree. However, sometimes, the compiler tries to parse and impose structure on this tree by parsing it as something like This parsing that converts an However, we must also decide how to expand |
Manishearth
removed
the
hacktoberfest
label
Sep 28, 2017
This comment has been minimized.
This comment has been minimized.
|
@rep-nop hey, I'm just checking in -- are you still hacking on this? How's it going? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis sorry, school has been keeping me fairly busy lately but things look like they're starting to lighten up for now! I spent ~2ish hours about 2 weeks ago on it and was getting somewhere I think, but I'm going to be hopefully trying a new approach that I hope will work better within the week (if not today even!) |
This comment has been minimized.
This comment has been minimized.
|
@rep-nop great =) Let me know if I can be of any assistance. |
rep-nop
added a commit
to rep-nop/rust
that referenced
this issue
Oct 17, 2017
This comment has been minimized.
This comment has been minimized.
|
Okay so while doing a more thorough read through the RFC I came up with a quick requirements document to track progress on it (below, it wont let me attach it for some reason? Let me know if I missed anything major or important!). The only part of the RFC I don't think I understand very well is the "Activation and unused attributes/lints" section. It talks about
|
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis @nrc any input? :) |
This comment has been minimized.
This comment has been minimized.
|
@rep-nop seems reasonable. =)
I think what this means it that we won't accept |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis so is that something that we're going to have to keep track of or..? Also, any idea where the whitelist will be located inside of the compiler? Currently, I just have it inside of the function as an array and the function checks against just the tool name (so should I make an attribute list for each one of them also?) and error if its not one of the whitelisted tools. The RFC talks about adding tools to that list from inside the source, however it looks like it wasn't decided on what that'd look like. @petrochenkov any suggestions/tips for a proper implementation? |
This comment has been minimized.
This comment has been minimized.
|
@rep-nop |
This comment has been minimized.
This comment has been minimized.
Yes. There are essentially two lists - one of lints and one of attributes. The compiler only cares about the active tools (initially both lists will be empty). So if the active attributes whitelist is
Yes, they are both on their way. The requirements looks good.
Good question! The lists could be provided by the build system, probably as an env var (or two). It should live somewhere that deals with tools. They could be hard-wired into the compiler, but I'm not really sure where I would put it. I don't think we need to worry about adding tools to the whitelist, we can do that manually. In terms of implementation, I think the checking of the whitelist names in attributes should happen either during macro name resolution or just afterwards. The key to when to do the check is about the behaviour we want with precedence (tool vs macro). If you have questions, @jseyfried is probably the best person to ask. |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the answers! :) @nrc right now I have it checking the names at name resolution when it detects a path inside the attribute, which wasn't too difficult to get a quick and crude implementation done (which I believe is linked above in a commit I did). I'll look into using an env var to specify tool names! |
This comment has been minimized.
This comment has been minimized.
|
@rep-nop Do you have any update? This is (potentially) blocking rustfmt from reaching 1.0, so I would like to push this forward. If you do not have enough time to work on this, I am willing to take a shot at this. |
This comment has been minimized.
This comment has been minimized.
|
@topecongiro ah if this is going to be blocking rustfmt I'll release it as I'm going to be fairly busy this upcoming semester. I was unfortunately not able to progress as much as I'd liked to have for various reasons, so have at it! :) |
topecongiro
referenced this issue
Jan 26, 2018
Closed
Implement tool_attributes feature (RFC 2103) #47773
bors
added a commit
that referenced
this issue
Feb 4, 2018
This comment has been minimized.
This comment has been minimized.
|
I would like to continue working on this, except @topecongiro wants to pick this up again? Since #47773 already implemented the |
This comment has been minimized.
This comment has been minimized.
|
@flip1995 I do not think that I can update the initial PR any time soon. So it will be great if you are going to work on this! |
petrochenkov
referenced this issue
Apr 15, 2018
Closed
Tracking issue for "macro naming and modularisation" (RFC #1561) #35896
petrochenkov
referenced this issue
Aug 17, 2018
Merged
Stabilize a few secondary macro features #53459
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Aug 22, 2018
bors
added a commit
that referenced
this issue
Aug 23, 2018
bors
added a commit
that referenced
this issue
Aug 23, 2018
bors
closed this
in
#53459
Aug 23, 2018
nrc
reopened this
Aug 23, 2018
This comment has been minimized.
This comment has been minimized.
|
This is only partially stable. |
flip1995
referenced this issue
Aug 28, 2018
Merged
Backwards compatibility for tool/clippy lints #53762
bors
added a commit
that referenced
this issue
Aug 30, 2018
bors
added a commit
that referenced
this issue
Sep 1, 2018
This comment has been minimized.
This comment has been minimized.
|
@nrc Is this stable "enough" for the edition? Can it be removed from the milestone? |
This comment has been minimized.
This comment has been minimized.
Yes! |
nrc
removed this from the Rust 2018 RC milestone
Sep 5, 2018
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Sep 7, 2018
|
@nrc: kind reminder to update the opening post with the current progress. |
ltratt
added a commit
to softdevteam/grmtools
that referenced
this issue
Sep 21, 2018
ltratt
added a commit
to softdevteam/grmtools
that referenced
this issue
Sep 21, 2018
ltratt
added a commit
to softdevteam/grmtools
that referenced
this issue
Sep 21, 2018
jtgeibel
referenced this issue
Sep 26, 2018
Merged
Ensure clippy is run for all targets and switch to clippy-preview on stable #1493
pietroalbini
added a commit
to pietroalbini/rust
that referenced
this issue
Oct 10, 2018
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Oct 10, 2018
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Oct 10, 2018
petrochenkov
removed their assignment
Oct 13, 2018
This comment has been minimized.
This comment has been minimized.
|
This appears to be stablilized, should the OP checkbox be ticked? |
nrc commentedSep 19, 2017
•
edited
Support scoped attributes for white-listed tools, e.g.,
#[rustfmt::skip]RFC
discussion thread
Current status: stabilised for attributes, some work still to do on lints.