Skip to content

Commit

Permalink
Add regression test for rust-lang#131618
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 21, 2025
1 parent b5b353b commit a6bbf15
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/rustdoc/const-display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@

//@ has 'foo/fn.foo.html' '//pre' 'pub fn foo() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has - '//span[@class="item-info"]//span' 'The const version is a \
// nightly-only experimental API. (foo)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const fn foo() -> u32 { 42 }

//@ has 'foo/fn.foo_unsafe.html' '//pre' 'pub unsafe fn foo_unsafe() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has - '//span[@class="item-info"]//span' 'The const version is a \
// nightly-only experimental API. (foo #111)'
//@ has - '//span[@class="item-info"]//a[@href="https://github.com/rust-lang/rust/issues/111"]' \
// '#111'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "111")]
pub const unsafe fn foo_unsafe() -> u32 { 42 }
Expand Down Expand Up @@ -63,12 +69,18 @@ pub struct Foo;
impl Foo {
//@ has 'foo/struct.Foo.html' '//*[@id="method.gated"]/h4[@class="code-header"]' 'pub fn gated() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has - '//span[@class="item-info"]//span' 'The const version is a \
// nightly-only experimental API. (foo #112)'
//@ has - '//span[@class="item-info"]//a[@href="https://github.com/rust-lang/rust/issues/112"]' \
// '#112'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
#[rustc_const_unstable(feature="foo", issue = "112")]
pub const fn gated() -> u32 { 42 }

//@ has 'foo/struct.Foo.html' '//*[@id="method.gated_unsafe"]/h4[@class="code-header"]' 'pub unsafe fn gated_unsafe() -> u32'
//@ has - '//span[@class="since"]' '1.0.0 (const: unstable)'
//@ has - '//span[@class="item-info"]//span' 'The const version is a \
// nightly-only experimental API. (foo)'
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo", issue = "none")]
pub const unsafe fn gated_unsafe() -> u32 { 42 }
Expand Down

0 comments on commit a6bbf15

Please sign in to comment.