rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.03k stars 12.68k forks source link

Allow multiple #[unstable] attributes on one item #94770

Open m-ou-se opened 2 years ago

m-ou-se commented 2 years ago

We sometimes have things that should be gated by multiple features. E.g. ScopedJoinHandle::is_running is part of scoped_threads, but also of thread_is_running. In these cases we now just apply only one of the #[unstable] attributes, and because of that sometimes accidentally stabilize something when only one of the features gets stabilized.

It'd be great if we could add multiple #[unstable] attributes to a single item. Allowing multiple #[stable] tags isn't a necessity. We could just remove the #[unstable] tag if the feature gets stabilized and there are other #[unstable] tags left. The most important part is that we don't forget about the other unstable tags and don't stabilize something by accident.

Another option would be multiple feature = arguments to #[unstable].

compiler-errors commented 2 years ago

@rustbot claim

dianne commented 1 month ago

I'd like to try picking this back up. Since it's been a while, would the desired design still be the same? Keeping the behavior of the old PR, I think this would allow potentially multiple #[unstable] attributes per item, but at most one #[stable], with no mixing of #[stable] and #[unstable] (and likewise for #[rustc_const_unstable]/#[rustc_const_stable]). I'm assuming #[rustc_default_body_unstable] should also be able to depend on multiple features in the same way.

dianne commented 3 weeks ago

@rustbot claim