|
1 | 1 | //@ edition: 2024
|
2 | 2 | #![crate_name = "foo"]
|
3 | 3 |
|
4 |
| -//@ has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[unsafe(no_mangle)]' |
| 4 | +//@ has foo/fn.f.html '//*[@class="code-attribute"]' '#[unsafe(no_mangle)]' |
5 | 5 | #[unsafe(no_mangle)]
|
6 | 6 | pub extern "C" fn f() {}
|
7 | 7 |
|
8 |
| -//@ has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[unsafe(export_name = "bar")]' |
| 8 | +//@ has foo/fn.g.html '//*[@class="code-attribute"]' '#[unsafe(export_name = "bar")]' |
9 | 9 | #[unsafe(export_name = "bar")]
|
10 | 10 | pub extern "C" fn g() {}
|
11 | 11 |
|
12 |
| -//@ has foo/fn.example.html '//pre[@class="rust item-decl"]' '#[unsafe(link_section = ".text")]' |
| 12 | +//@ has foo/fn.example.html '//*[@class="code-attribute"]' '#[unsafe(link_section = ".text")]' |
13 | 13 | #[unsafe(link_section = ".text")]
|
14 | 14 | pub extern "C" fn example() {}
|
15 | 15 |
|
16 |
| -//@ has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]' |
| 16 | +//@ has foo/struct.Repr.html '//*[@class="code-attribute"]' '#[repr(C, align(8))]' |
17 | 17 | #[repr(C, align(8))]
|
18 | 18 | pub struct Repr;
|
| 19 | + |
| 20 | +//@ has foo/macro.macro_rule.html '//*[@class="code-attribute"]' '#[unsafe(link_section = ".text")]' |
| 21 | +#[unsafe(link_section = ".text")] |
| 22 | +#[macro_export] |
| 23 | +macro_rules! macro_rule { |
| 24 | + () => {}; |
| 25 | +} |
| 26 | + |
| 27 | +//@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "enum")]' |
| 28 | +#[unsafe(link_section = "enum")] |
| 29 | +pub enum Enum { |
| 30 | + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "a")]' |
| 31 | + #[unsafe(link_section = "a")] |
| 32 | + A, |
| 33 | + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "quz")]' |
| 34 | + #[unsafe(link_section = "quz")] |
| 35 | + Quz { |
| 36 | + //@ has 'foo/enum.Enum.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "b")]' |
| 37 | + #[unsafe(link_section = "b")] |
| 38 | + b: (), |
| 39 | + }, |
| 40 | +} |
| 41 | + |
| 42 | +//@ has 'foo/trait.Trait.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "trait")]' |
| 43 | +#[unsafe(link_section = "trait")] |
| 44 | +pub trait Trait { |
| 45 | + //@ has 'foo/trait.Trait.html' |
| 46 | + //@ has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]/*[@class="code-attribute"]' '#[unsafe(link_section = "bar")]' |
| 47 | + //@ has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' 'const BAR: u32 = 0u32' |
| 48 | + #[unsafe(link_section = "bar")] |
| 49 | + const BAR: u32 = 0; |
| 50 | + |
| 51 | + //@ has - '//*[@class="code-attribute"]' '#[unsafe(link_section = "foo")]' |
| 52 | + #[unsafe(link_section = "foo")] |
| 53 | + fn foo() {} |
| 54 | +} |
| 55 | + |
| 56 | +//@ has 'foo/union.Union.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "union")]' |
| 57 | +#[unsafe(link_section = "union")] |
| 58 | +pub union Union { |
| 59 | + //@ has 'foo/union.Union.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "x")]' |
| 60 | + #[unsafe(link_section = "x")] |
| 61 | + pub x: u32, |
| 62 | + y: f32, |
| 63 | +} |
| 64 | + |
| 65 | +//@ has 'foo/struct.Struct.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "struct")]' |
| 66 | +#[unsafe(link_section = "struct")] |
| 67 | +pub struct Struct { |
| 68 | + //@ has 'foo/struct.Struct.html' '//*[@class="code-attribute"]' '#[unsafe(link_section = "x")]' |
| 69 | + #[unsafe(link_section = "x")] |
| 70 | + pub x: u32, |
| 71 | + y: f32, |
| 72 | +} |
| 73 | + |
| 74 | +// Check that the attributes from the trait items show up consistently in the impl. |
| 75 | +//@ has 'foo/struct.Struct.html' '//*[@id="trait-implementations-list"]//*[@class="code-attribute"]' '#[unsafe(link_section = "bar")]' |
| 76 | +//@ has 'foo/struct.Struct.html' '//*[@id="trait-implementations-list"]//*[@class="code-attribute"]' '#[unsafe(link_section = "foo")]' |
| 77 | +impl Trait for Struct {} |
0 commit comments