File: inner-attrs.rs

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,245,420 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (88 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// gate-test-custom_inner_attributes
//@ compile-flags: -Z span-debug --error-format human
//@ error-pattern:expected non-macro inner attribute
//@ aux-build:test-macros.rs
//@ edition:2018

#![feature(custom_inner_attributes)]
#![feature(proc_macro_hygiene)]
#![feature(stmt_expr_attributes)]
#![feature(rustc_attrs)]

#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;

#[macro_use]
extern crate test_macros;

#[print_target_and_args(first)]
#[print_target_and_args(second)]
fn foo() {
    #![print_target_and_args(third)]
    #![print_target_and_args(fourth)]
}

#[print_target_and_args(mod_first)]
#[print_target_and_args(mod_second)]
mod inline_mod {
    #![print_target_and_args(mod_third)]
    #![print_target_and_args(mod_fourth)]
}

struct MyStruct {
    field: bool
}

#[derive(Print)]
struct MyDerivePrint {
    field: [u8; {
        match true {
            _ => {
                #![cfg_attr(not(FALSE), rustc_dummy(third))]
                true
            }
        };
        0
    }]
}

fn bar() {
    #[print_target_and_args(tuple_attrs)] (
        3, 4, {
            #![cfg_attr(not(FALSE), rustc_dummy(innermost))]
            5
        }
    );

    #[print_target_and_args(tuple_attrs)] (
        3, 4, {
            #![cfg_attr(not(FALSE), rustc_dummy(innermost))]
            5
        }
    );

    for _ in &[true] {
        #![print_attr]
    }

    let _ = {
        #![print_attr]
    };

    let _ = async {
        #![print_attr]
    };

    {
        #![print_attr]
    };
}


extern {
    fn weird_extern() {
        #![print_target_and_args_consume(tenth)]
    }
}

fn main() {}