-
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
feat: apply #[cfg]
to proc macro inputs
#16789
Conversation
I do have a few questions for the team that works on Rust Analyzer.
|
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoying we have to do this on the syntax tree but there is no way around that. note that
struct S {
field: fn(#[cfg(FALSE)] ()) -> ()
}
here we also need to configure the param away. It's fine to not support this right now though, I think we should probably have this infra here traverse the token tree in an untyped manner and just look for attributes and then handle things accordingly? Unsure.
Anyways with the few things I've raised I'm fine with merging this for now, since you said you were planning on tackling full cfg_attr
supports, cleaning up and what not can be done afterwards (since the changes are all tied closely to a single module).
Forgot to answer your questions:
If this is easily doable (which it looks like it should be), then yes let's do that for now so we can test it a bit.
Seems right to do this
I don't think so
Not really |
How do I get the settings from the expand db?
Actually you already provided one |
We'd have to thread that through the database which is kind of annoying actually. Should be fine to not put this behind a config then. It shouldn't really break anything anyways (or rather make it worse than the status quo). Also would be nice to add a test that this works as expected for our builtin derives in |
Actually there is another one, |
Do you want that here? Or should that be done when we handle multiple attributes? |
that is fine to skip for now, its a very rare occurence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, lgtm 👍 (a few things I'd clean up slightly, but I think that can wait until your follow up and I might just do that myself, don't wanna nitpick and block a PR that way)
☀️ Test successful - checks-actions |
#[cfg]
to proc macro inputs
This will attempt to process cfg attributes and cfg_attr attributes for proc macro expansion.
Closes #8434 , #11657, and #13904