Join GitHub today
Tracking issue for RFC 2539, "#[cfg_attr] expanding to multiple attributes" #54881
referenced this issue
Oct 7, 2018
Originally proposed in RFC rust-lang/rfcs#2539, implemented in #54862, and in nightly since ~ the 12th October,
The next version is 1.32 which goes into beta the 7th of December; It is quite possible that this will slip into 1.33 however depending on how long the review process takes.
What is stabilized
Users are now permitted to write for example:
#[cfg_attr(all(),)] struct A; // trailing comma permitted as well as zero items. #[cfg_attr(all(), must_use)] struct A; #[cfg_attr(all(), must_use,)] struct A; // trailing permitted. #[cfg_attr(foo, must_use, deprecated)] struct A; #[cfg_attr(all(), must_use, deprecated,)] struct A; // trailing permitted.
The semantics of these are to expand to for example
If zero attributes are given, e.g.
What is not
Users are not permitted to write:
Divergences from RFC
Team member @Centril has proposed to merge this. The next step is review by the rest of the tagged teams:
No concerns currently listed.
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
I wouldn't call the implementation of the lint a minor fix. The first time I tried, I bailed when I hit a set of cases I couldn't get something the lint infrastructure wanted.
The lint is also the least value add of the RFC and I propose stabilizing it separately if doing so doesn't break backwards compatibility.
@Havvy Warn by default lints can always be added later so if you think it is non-trivial to implement in the stabilization PR, I wouldn't mind deferring that to the future; as you say, it is indeed the least value-add. However, if you do manage to fix it in the stabilization PR, that would be nice (but not required, imo).