-
Notifications
You must be signed in to change notification settings - Fork 13.8k
rustdoc: decouple stability and const-stability #91694
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,20 @@ impl Foo { | |
#[rustc_const_stable(feature = "rust1", since = "1.2.0")] | ||
pub const fn stable_impl() -> u32 { 42 } | ||
} | ||
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub struct Bar; | ||
|
||
impl Bar { | ||
// Do not show non-const stabilities that are the same as the enclosing item. | ||
// @matches 'foo/struct.Bar.html' '//span[@class="since"]' '^const: 1.2.0$' | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_const_stable(feature = "rust1", since = "1.2.0")] | ||
pub const fn stable_impl() -> u32 { 42 } | ||
|
||
// Show const-stability even for unstable functions. | ||
// @matches 'foo/struct.Bar.html' '//span[@class="since"]' '^const: 1.3.0$' | ||
#[unstable(feature = "foo2", issue = "none")] | ||
#[rustc_const_stable(feature = "rust1", since = "1.3.0")] | ||
|
||
pub const fn const_stable_unstable() -> u32 { 42 } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
1.0.0
still displayed? If not, please put it back like it used to. In any case, please add a test to ensure both are displayed if both are present like it's currently the case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GuillaumeGomez This is one of the goals of this PR. Currently, stabilities are omitted if the stability of the item matches the stability of the enclosing struct or module, except if they also have a const stability.
This PR updates the logic to always omit the stability if it matches, regardless of whether the item is const-stable or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Thanks for the explanations!