Rollup merge of #91694 - euclio:stability-improvements, r=GuillaumeGomez
rustdoc: decouple stability and const-stability This PR tweaks the stability rendering code to consider stability and const-stability separately. This fixes two issues: - Stabilities that match the enclosing item are now always omitted, even if the item has const-stability as well (#90552) - Const-stable unstable functions will now have their (const-) stability rendered. Fixes #90552.
This commit is contained in:
commit
405cf20442
3 changed files with 73 additions and 37 deletions
|
|
@ -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 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct Bar;
|
|||
|
||||
impl Bar {
|
||||
// @has - '//*[@id="method.len"]' 'pub const fn len(&self) -> usize'
|
||||
// @has - '//*[@id="method.len"]//span[@class="since"]' '1.0.0 (const: 1.0.0)'
|
||||
// @has - '//*[@id="method.len"]//span[@class="since"]' 'const: 1.0.0'
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const fn len(&self) -> usize { 0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue