diff options
| author | bors <bors@rust-lang.org> | 2020-08-31 03:19:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-08-31 03:19:05 +0000 |
| commit | e98f0632bbec24b196dbd6fc820537f6f3724807 (patch) | |
| tree | 52494c35f981ca033b005c364b5adda9ccd40cc9 /src | |
| parent | 92290d1631c0c0d87610cee842cc0d03fb95d6d0 (diff) | |
| parent | d9208665b5eef883c025f44717f8c76afa871a94 (diff) | |
Auto merge of #75082 - Aaron1011:feature/proc-macro-backtrace, r=petrochenkov
Add `-Z proc-macro-backtrace` to allow showing proc-macro panics Fixes #75050 Previously, we would unconditionally suppress the panic hook during proc-macro execution. This commit adds a new flag `-Z proc-macro-backtrace`, which allows running the panic hook for easier debugging.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/proc-macro/load-panic-backtrace.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/load-panic-backtrace.stderr | 11 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/load-panic-backtrace.rs b/src/test/ui/proc-macro/load-panic-backtrace.rs new file mode 100644 index 00000000000..90fe109abb8 --- /dev/null +++ b/src/test/ui/proc-macro/load-panic-backtrace.rs @@ -0,0 +1,21 @@ +// aux-build:test-macros.rs +// compile-flags: -Z proc-macro-backtrace +// rustc-env:RUST_BACKTRACE=0 + +// FIXME https://github.com/rust-lang/rust/issues/59998 +// normalize-stderr-test "thread '.*' panicked " -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" +// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" + +#[macro_use] +extern crate test_macros; + +#[derive(Panic)] +//~^ ERROR: proc-macro derive panicked +struct Foo; + +fn main() {} diff --git a/src/test/ui/proc-macro/load-panic-backtrace.stderr b/src/test/ui/proc-macro/load-panic-backtrace.stderr new file mode 100644 index 00000000000..63378b5735a --- /dev/null +++ b/src/test/ui/proc-macro/load-panic-backtrace.stderr @@ -0,0 +1,11 @@ +at 'panic-derive', $DIR/auxiliary/test-macros.rs:43:5 +error: proc-macro derive panicked + --> $DIR/load-panic-backtrace.rs:17:10 + | +LL | #[derive(Panic)] + | ^^^^^ + | + = help: message: panic-derive + +error: aborting due to previous error + |
