Stability attributes for third-party libraries?

A few weeks (months?) ago, it was possible to add #[stable], #[unstable], #[deprecated], etc. attributes to the functions of your own rust libraries. These markers would show up in the docs generated by rustdoc, and if a user was using a deprecated function they would get a warning.

When suddenly after some change in the system, they stopped being recognized. Rustdoc shows “no stability level” for all functions, and users don’t get warnings if they use deprecated functions coming from third-party libraries.

What are the plans about this? I didn’t find any issue about this and it looks like an intended change, which is sad. The #[deprecated] attribute especially would be very useful.

1 Like

The new design was outlined in RFC 507. The system was/is explicitly designed for use by the standard library only. However, everyone (core team and otherwise) wants external libraries to have this sort of functionality available too, and we aim to provide something.

The discussion on that RFC includes more details, @alexcrichton’s summary comment serves as a table-of-contents.

Unfortunately it seems that #[staged_stable] and #[staged_deprecated] aren’t recognized by the compiler :-/

Recent nightly added an error:

stability attributes may not be used outside of the standard library

That's a shame, because I was developing a library and well, a lot of it was unstable :smile:

The tags were useful for marking finished/unfinished parts of the library in rustdoc.

Yes, this change was accepted long ago, but we didn’t actually write the code until recently.

The current stability attributes are very tied to the channels release process. We absolutely agree that something like it would be good for external crates, but they should be designed for that use case, specifically.

I just anything, something simple, to signal a warning on deprecated items. This is needed to have a good communication with users.

Even more so I think when the crate version is pre-1.0… We don’t promise anything, but we still want to give users some warning before stuff is removed or changed.

You should write up an RFC!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.