rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Stability attribute for library authors

Open adamcrume opened this issue 8 years ago • 11 comments

Rust needs an #[unstable] attribute for library authors to use, similar to the #[unstable] attribute used by the standard library.

adamcrume avatar Feb 06 '16 04:02 adamcrume

I expect much of the reasoning for this could be based on https://github.com/rust-lang/rfcs/pull/1270 (#[deprecated] for Everyone)

codyps avatar Feb 06 '16 18:02 codyps

A huge :+1: for this from me. I miss this feature. I think everyone agrees it's wanted, I'm not 100% sure what all the open questions are, and why it was removed prior to 1.0. I do recall the argument being that the current system was designed for std but I'm not sure what would need to change.

nixpulvis avatar Feb 08 '16 06:02 nixpulvis

I am really wandering why all #[stable], #[unstable] and #[deprecated] flags were removed from Rust 1.0. All of them were really usable in real world libraries to mark which segments of API are still prone to change and which are already set.

hauleth avatar May 31 '16 12:05 hauleth

It's as the above comment said; the current ones were designed for the needs of the compiler, but the ecosystem has different needs.

On Tue, May 31, 2016 at 8:52 AM, Łukasz Jan Niemier < [email protected]> wrote:

I am really wandering why all #[stable], #[unstable] and #[deprecated] flags were removed from Rust 1.0. All of them were really usable in real world libraries to mark which segments of API are still prone to change and which are already set.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rust-lang/rfcs/issues/1491#issuecomment-222678860, or mute the thread https://github.com/notifications/unsubscribe/AABsisG0gwbGApx_YdRyhBzyG92yP698ks5qHC7ygaJpZM4HUyZS .

steveklabnik avatar May 31 '16 13:05 steveklabnik

I'd like to see this as well. In particular, I'd like to see this with support for version markers, to make it easier for tools to say "what version of this crate do I need based on the features I use".

joshtriplett avatar Jan 10 '17 04:01 joshtriplett

A general solution would be great in conjunction with #1133.

Ericson2314 avatar Jan 10 '17 06:01 Ericson2314

There's this "pre RFC": https://internals.rust-lang.org/t/pre-rfc-crate-item-stability/4425/12 (rendered).

It would be nice to see some progress on this. Rather than an #[unstable] attribute it would make more sense to me if only items marked #[stable] would be considered stable, and Cargo would get some new functionality to allow opt in/out of stability checking for the whole crate and per dependency.

Edit: maybe I'm slow, but I realise we don't necessarily need a new compiler feature. We already have features so can do #[cfg(feature="unstable")] or more fine grained control with individual features.

dhardy avatar Nov 18 '17 16:11 dhardy

Is any work done on this?

oilaba avatar Apr 07 '21 17:04 oilaba

I've created this experimental proc-macro to somewhat mimic this behavior suitable for libraries: https://docs.rs/stability/0.1.0/stability/attr.unstable.html. Not as good as the real deal but hopefully almost as useful.

sagebind avatar Apr 07 '21 17:04 sagebind

Any perspectives on this?

Dzordzu avatar Dec 18 '23 16:12 Dzordzu

Put me in coach!

nixpulvis avatar Dec 18 '23 17:12 nixpulvis