2021-02-28 13:51:44 -06:00
|
|
|
// compile-flags: -Z span-debug --error-format human
|
|
|
|
// aux-build:test-macros.rs
|
|
|
|
|
|
|
|
#![feature(custom_inner_attributes)]
|
|
|
|
#![feature(proc_macro_hygiene)]
|
|
|
|
#![feature(stmt_expr_attributes)]
|
2021-03-01 15:02:09 -06:00
|
|
|
#![feature(rustc_attrs)]
|
2021-02-28 13:51:44 -06: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)]
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MyStruct {
|
|
|
|
field: bool
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
(#![print_target_and_args(fifth)] 1, 2);
|
2021-03-01 15:02:09 -06:00
|
|
|
//~^ ERROR expected non-macro inner attribute, found attribute macro
|
|
|
|
|
|
|
|
#[print_target_and_args(tuple_attrs)] (
|
|
|
|
#![cfg_attr(FALSE, rustc_dummy)]
|
|
|
|
3, 4, {
|
|
|
|
#![cfg_attr(not(FALSE), rustc_dummy(innermost))]
|
|
|
|
5
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
#[print_target_and_args(array_attrs)] [
|
|
|
|
#![rustc_dummy(inner)]
|
|
|
|
true; 0
|
|
|
|
];
|
2021-02-28 13:51:44 -06:00
|
|
|
|
|
|
|
[#![print_target_and_args(sixth)] 1 , 2];
|
2021-03-01 15:02:09 -06:00
|
|
|
//~^ ERROR expected non-macro inner attribute, found attribute macro
|
2021-02-28 13:51:44 -06:00
|
|
|
[#![print_target_and_args(seventh)] true ; 5];
|
2021-03-01 15:02:09 -06:00
|
|
|
//~^ ERROR expected non-macro inner attribute, found attribute macro
|
2021-02-28 13:51:44 -06:00
|
|
|
|
|
|
|
match 0 {
|
|
|
|
#![print_target_and_args(eighth)]
|
2021-03-01 15:02:09 -06:00
|
|
|
//~^ ERROR expected non-macro inner attribute, found attribute macro
|
2021-02-28 13:51:44 -06:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
|
|
|
|
MyStruct { #![print_target_and_args(ninth)] field: true };
|
2021-03-01 15:02:09 -06:00
|
|
|
//~^ ERROR expected non-macro inner attribute, found attribute macro
|
2021-02-28 13:51:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
extern {
|
|
|
|
fn weird_extern() {
|
|
|
|
#![print_target_and_args_consume(tenth)]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|