Rollup merge of #79548 - CraftSpider:76998, r=jyn514
Show since when a function is const in stdlib Fixes #76998 This makes it so that functions with the `#[rustc_const_stable()]` attribute now show from what version they were stably declared const, alongside what version they were declared stable. Example from `Result`:  r? ``@jyn514``
This commit is contained in:
commit
33d7b8c65c
7 changed files with 99 additions and 18 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
#![unstable(feature = "humans",
|
||||
|
|
@ -17,6 +19,7 @@ pub const unsafe fn foo() -> u32 { 42 }
|
|||
pub const fn foo2() -> u32 { 42 }
|
||||
|
||||
// @has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32'
|
||||
// @has - //span '1.0.0 (const: 1.0.0)'
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const fn bar2() -> u32 { 42 }
|
||||
|
|
@ -26,6 +29,7 @@ pub const fn bar2() -> u32 { 42 }
|
|||
pub const unsafe fn foo2_gated() -> u32 { 42 }
|
||||
|
||||
// @has 'foo/fn.bar2_gated.html' '//pre' 'pub const unsafe fn bar2_gated() -> u32'
|
||||
// @has - '//span[@class="since"]' '1.0.0 (const: 1.0.0)'
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const unsafe fn bar2_gated() -> u32 { 42 }
|
||||
|
|
@ -40,4 +44,10 @@ impl Foo {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature="foo", issue = "none")]
|
||||
pub const unsafe fn gated() -> u32 { 42 }
|
||||
|
||||
// @has 'foo/struct.Foo.html' '//h4[@id="method.stable_impl"]/code' 'pub const fn stable_impl() -> u32'
|
||||
// @has - '//span[@class="since"]' '1.0.0 (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 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue