about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-20 19:26:12 +0000
committerbors <bors@rust-lang.org>2018-12-20 19:26:12 +0000
commit09d6ab90e556bf692ff3f8790d97b3ca4fee94b0 (patch)
tree32af76136e0801c1dc922fce40064f3118780f45 /src/test/rustdoc
parent9622f9dc4745eb59fd229477f453ae83e8044db9 (diff)
parenta6943d9d66d6dc8b7be9db556e28dbc8125f7336 (diff)
downloadrust-09d6ab90e556bf692ff3f8790d97b3ca4fee94b0.tar.gz
rust-09d6ab90e556bf692ff3f8790d97b3ca4fee94b0.zip
Auto merge of #56845 - GuillaumeGomez:const-docs, r=oli-obk
Don't render const keyword on stable

Fixes #55246.

Continuation of #55327.

r? @oli-obk
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/const-display.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs
new file mode 100644
index 00000000000..8ac0d07ceef
--- /dev/null
+++ b/src/test/rustdoc/const-display.rs
@@ -0,0 +1,43 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_name = "foo"]
+
+#![unstable(feature = "humans",
+            reason = "who ever let humans program computers, we're apparently really bad at it",
+            issue = "0")]
+
+#![feature(rustc_const_unstable, const_fn, foo, foo2)]
+#![feature(min_const_unsafe_fn)]
+#![feature(staged_api)]
+
+// @has 'foo/fn.foo.html' '//pre' 'pub unsafe fn foo() -> u32'
+#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_const_unstable(feature="foo")]
+pub const unsafe fn foo() -> u32 { 42 }
+
+// @has 'foo/fn.foo2.html' '//pre' 'pub fn foo2() -> u32'
+#[unstable(feature = "humans", issue="0")]
+pub const fn foo2() -> u32 { 42 }
+
+// @has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32'
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const fn bar2() -> u32 { 42 }
+
+// @has 'foo/fn.foo2_gated.html' '//pre' 'pub unsafe fn foo2_gated() -> u32'
+#[unstable(feature = "foo2", issue="0")]
+pub const unsafe fn foo2_gated() -> u32 { 42 }
+
+// @has 'foo/fn.bar2_gated.html' '//pre' 'pub const unsafe fn bar2_gated() -> u32'
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const unsafe fn bar2_gated() -> u32 { 42 }
+
+// @has 'foo/fn.bar_not_gated.html' '//pre' 'pub unsafe fn bar_not_gated() -> u32'
+pub const unsafe fn bar_not_gated() -> u32 { 42 }