diff options
Diffstat (limited to 'tests/ui/cross/cross-crate-macro-backtrace')
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs b/tests/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs new file mode 100644 index 000000000..fbda3dbe9 --- /dev/null +++ b/tests/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs @@ -0,0 +1,13 @@ +#![crate_type = "dylib"] + +pub fn print(_args: std::fmt::Arguments) {} + +#[macro_export] +macro_rules! myprint { + ($($arg:tt)*) => ($crate::print(format_args!($($arg)*))); +} + +#[macro_export] +macro_rules! myprintln { + ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); +} diff --git a/tests/ui/cross/cross-crate-macro-backtrace/main.rs b/tests/ui/cross/cross-crate-macro-backtrace/main.rs new file mode 100644 index 000000000..f7d4330ab --- /dev/null +++ b/tests/ui/cross/cross-crate-macro-backtrace/main.rs @@ -0,0 +1,8 @@ +// aux-build:extern_macro_crate.rs +#[macro_use(myprintln, myprint)] +extern crate extern_macro_crate; + +fn main() { + myprintln!("{}"); + //~^ ERROR in format string +} diff --git a/tests/ui/cross/cross-crate-macro-backtrace/main.stderr b/tests/ui/cross/cross-crate-macro-backtrace/main.stderr new file mode 100644 index 000000000..5bd4ea97e --- /dev/null +++ b/tests/ui/cross/cross-crate-macro-backtrace/main.stderr @@ -0,0 +1,10 @@ +error: 1 positional argument in format string, but no arguments were given + --> $DIR/main.rs:6:5 + | +LL | myprintln!("{}"); + | ^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `concat` which comes from the expansion of the macro `myprintln` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + |