2022-08-28 12:23:39 +00:00
|
|
|
// gate-test-custom_inner_attributes
|
2021-02-28 19:51:44 +00:00
|
|
|
// compile-flags: -Z span-debug --error-format human
|
|
|
|
// aux-build:test-macros.rs
|
2021-04-08 21:01:15 +00:00
|
|
|
// edition:2018
|
2021-03-19 23:52:07 +00:00
|
|
|
|
2021-02-28 19:51:44 +00:00
|
|
|
#![feature(custom_inner_attributes)]
|
|
|
|
#![feature(proc_macro_hygiene)]
|
|
|
|
#![feature(stmt_expr_attributes)]
|
2021-03-01 21:02:09 +00:00
|
|
|
#![feature(rustc_attrs)]
|
2021-02-28 19:51:44 +00:00
|
|
|
|
|
|
|
#![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)]
|
|
|
|
}
|
|
|
|
|
2021-04-08 21:01:15 +00:00
|
|
|
#[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)]
|
|
|
|
}
|
|
|
|
|
2021-02-28 19:51:44 +00:00
|
|
|
struct MyStruct {
|
|
|
|
field: bool
|
|
|
|
}
|
|
|
|
|
2021-04-08 21:01:15 +00:00
|
|
|
#[derive(Print)]
|
|
|
|
struct MyDerivePrint {
|
|
|
|
field: [u8; {
|
|
|
|
match true {
|
|
|
|
_ => {
|
2020-11-28 23:33:17 +00:00
|
|
|
#![cfg_attr(not(FALSE), rustc_dummy(third))]
|
2021-04-08 21:01:15 +00:00
|
|
|
true
|
|
|
|
}
|
|
|
|
};
|
|
|
|
0
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
|
2021-02-28 19:51:44 +00:00
|
|
|
fn bar() {
|
2021-03-01 21:02:09 +00:00
|
|
|
#[print_target_and_args(tuple_attrs)] (
|
|
|
|
3, 4, {
|
|
|
|
#![cfg_attr(not(FALSE), rustc_dummy(innermost))]
|
|
|
|
5
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-04-08 21:01:15 +00:00
|
|
|
#[print_target_and_args(tuple_attrs)] (
|
|
|
|
3, 4, {
|
|
|
|
#![cfg_attr(not(FALSE), rustc_dummy(innermost))]
|
|
|
|
5
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
for _ in &[true] {
|
|
|
|
#![print_attr] //~ ERROR expected non-macro inner attribute
|
|
|
|
}
|
|
|
|
|
|
|
|
let _ = {
|
|
|
|
#![print_attr] //~ ERROR expected non-macro inner attribute
|
|
|
|
};
|
|
|
|
|
|
|
|
let _ = async {
|
|
|
|
#![print_attr] //~ ERROR expected non-macro inner attribute
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
#![print_attr] //~ ERROR expected non-macro inner attribute
|
|
|
|
};
|
2021-02-28 19:51:44 +00:00
|
|
|
}
|
|
|
|
|
2021-04-08 21:01:15 +00:00
|
|
|
|
2021-02-28 19:51:44 +00:00
|
|
|
extern {
|
|
|
|
fn weird_extern() {
|
|
|
|
#![print_target_and_args_consume(tenth)]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|