diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-20 17:10:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-20 17:10:33 +0100 |
| commit | 405cf2044210f5f2286d6b526882744d403ea805 (patch) | |
| tree | 3f3f6e966f6a074ae8f699427035ae49b9d92c73 /src/test/rustdoc | |
| parent | 02379e917b2e187997bdabd290e61ecf0744faaf (diff) | |
| parent | dc1c39b10ed4650de784e860e2778c3e246f585e (diff) | |
| download | rust-405cf2044210f5f2286d6b526882744d403ea805.tar.gz rust-405cf2044210f5f2286d6b526882744d403ea805.zip | |
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.
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/const-display.rs | 17 | ||||
| -rw-r--r-- | src/test/rustdoc/deref-const-fn.rs | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index fb8ea7e33c2..b8e101038f8 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -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 } +} diff --git a/src/test/rustdoc/deref-const-fn.rs b/src/test/rustdoc/deref-const-fn.rs index ca51f3c7b5a..8ecca6d12d2 100644 --- a/src/test/rustdoc/deref-const-fn.rs +++ b/src/test/rustdoc/deref-const-fn.rs @@ -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 } |
