summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-12-01 10:50:21 +0000
committerGitHub <noreply@github.com>2020-12-01 10:50:21 +0000
commit33d7b8c65c6180143dfddbc4c7556c910fe1b9c8 (patch)
treecee88ff184dfc511c6d43156807aabdb11ca4642 /src/test/rustdoc
parentf45e6953d76d886bb649ffd80f1e19ce2e1bfeda (diff)
parentccbb0f5c1a1100b271f9945add665c692a2bf230 (diff)
downloadrust-33d7b8c65c6180143dfddbc4c7556c910fe1b9c8.tar.gz
rust-33d7b8c65c6180143dfddbc4c7556c910fe1b9c8.zip
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`:
![image](https://user-images.githubusercontent.com/13342132/100561194-1be60d00-3286-11eb-99ff-1e81201218a9.png)

r? ``@jyn514``
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/const-display.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs
index b3fbe377f0b..11ba68a388f 100644
--- a/src/test/rustdoc/const-display.rs
+++ b/src/test/rustdoc/const-display.rs
@@ -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 }
 }