about summary refs log tree commit diff
path: root/tests/rustdoc/type-alias/repr.rs
blob: 884ed74264a58af547e4434ef8d7a93ec4cf08e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// This test ensures that the `repr` attribute is displayed in type aliases.
//
// Regression test for <https://github.com/rust-lang/rust/issues/140739>.

#![crate_name = "foo"]

/// bla
#[repr(C)]
pub struct Foo1;

//@ has 'foo/type.Bar1.html'
//@ has - '//*[@class="rust item-decl"]/code' '#[repr(C)]pub struct Bar1;'
// Ensures that we see the doc comment of the type alias and not of the aliased type.
//@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'bar'
/// bar
pub type Bar1 = Foo1;

/// bla
#[repr(C)]
pub union Foo2 {
    pub a: u8,
}

//@ has 'foo/type.Bar2.html'
//@ matches - '//*[@class="code-attribute"]' '#\[repr\(C\)\]'
//@ matches - '//*[@class="rust item-decl"]' 'pub union Bar2 \{*'
// Ensures that we see the doc comment of the type alias and not of the aliased type.
//@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'bar'
/// bar
pub type Bar2 = Foo2;

/// bla
#[repr(C)]
pub enum Foo3 {
    A,
}

//@ has 'foo/type.Bar3.html'
//@ matches - '//*[@class="rust item-decl"]' '#\[repr\(C\)\]pub enum Bar3 \{*'
// Ensures that we see the doc comment of the type alias and not of the aliased type.
//@ has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'bar'
/// bar
pub type Bar3 = Foo3;