mbe: Add test for attribute expansion with compile_error!
This commit is contained in:
parent
4f999f72de
commit
bd5206ee18
2 changed files with 26 additions and 0 deletions
13
tests/ui/macros/macro-rules-attr-error.rs
Normal file
13
tests/ui/macros/macro-rules-attr-error.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#![feature(macro_attr)]
|
||||
|
||||
macro_rules! local_attr {
|
||||
attr() { $($body:tt)* } => {
|
||||
compile_error!(concat!("local_attr: ", stringify!($($body)*)));
|
||||
};
|
||||
//~^^ ERROR: local_attr
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[local_attr]
|
||||
struct S;
|
||||
}
|
||||
13
tests/ui/macros/macro-rules-attr-error.stderr
Normal file
13
tests/ui/macros/macro-rules-attr-error.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error: local_attr: struct S;
|
||||
--> $DIR/macro-rules-attr-error.rs:5:9
|
||||
|
|
||||
LL | compile_error!(concat!("local_attr: ", stringify!($($body)*)));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL | #[local_attr]
|
||||
| ------------- in this attribute macro expansion
|
||||
|
|
||||
= note: this error originates in the attribute macro `local_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue