-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add support for #[doc(since="version")]
attribute
#74182
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
Comments
We had been asked about it in the past too but it got rejected at that time. However I am very favorable to this add. |
This is a duplicate of #74182 (created earlier, but with less discussion). |
@jyn514 Sorry, I think you posted the wrong duplicated issue, because it is just this one 😄 |
Oh oops, thanks! I meant to link to #79663. |
I don't think this is the same feature as #79663: that issue is about having a way to mark items as unstable, while this is just to add a "since 1.2.3" near the function signature. |
@pietroalbini staged_api does both those things. I guess it depends whether you count #79663 as a request to stabilize all of staged_api or just deprecations. |
I think it's better to keep this and Stabilizing |
It could be neat for this attribute to support linking to the changelog for the version specified (inspired by the Rust Search Extension): This would probably require a way to globally specify a root changelog URL for a given crate. |
In addition to being useful as a hint in the rendered API documentation, this annotation could be helpful for tools in automatically detecting minimal dependency versions. Even if not all of a library is annotated, tools would know they can start testing with "at least version X". Testing whether a using crate still compiles with some version obviously doesn't catch all kinds of breaking changes in an API, so unless the entire API is annotated with this attribute, automatic minimal dependency version detection would never be reliable. However, this attribute still allows for an "educated guess" in those cases. |
Major new features like this should have an RFC IMO. |
To the present day, the internal crates like
core
andstd
can annotate things with#[stable(since="version")]
. This is extremely useful for users, especially becauserustdoc
is able to write this information in the rendered documentation.Unfortunately, this kind of feature is not available for normal crates. Take, for instance,
tokio::runtime::Handle::current
: this function is available since version0.2.8
of thetokio
crate (not sure about0.2.7
, that's not the point), but this information is not available at a first glimpse.IMHO, adding the possibility of annotating functions, structs and traits (and maybe something I missed) with
#[doc(since="version")]
would give more doc power to crates' authors. Moreover, it should be possible to leverage the current implementation ofstable(since="version")
in order to introduce the feature without reinventing the wheel.The text was updated successfully, but these errors were encountered: