-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
RFC: conditional attributes #12479
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
Comments
I assume that |
Something like that. |
One snag I can imagine is that sometimes predicates are more complicated than just |
That issue seems to be #2119. |
Needs to become a proper RFC... |
matthiaskrgr
pushed a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 21, 2024
move `readonly_write_lock` to perf [There haven't been any issues](https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+readonly_write_lock) since its creation and it's a pretty useful lint I think, so I'd say it's worth giving it a try? Did a lintcheck run on 300 crates with no results, but I guess `RwLock` is usually not something that's used much in libraries. changelog: move [`readonly_write_lock`] to perf (now warn-by-default)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the only way to have attributes that apply conditionally is to duplicate the whole item (e.g.
#[link()]
extern metadata that change per platform, or wish to have dynamic/static linking toggled externally). It'd be nice to have be able to avoid this.Proposal: add
cfg_attr(predicate, attribute)
that only appliesattribute
ifpredicate
is satisfied. e.g.currently has to be
The text was updated successfully, but these errors were encountered: