Test std::backtrace::Backtrace

Fixes #1578
This commit is contained in:
Aaron Hill 2020-10-17 15:36:05 -04:00
parent 2f390c05e5
commit 8b10dbfeaa
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// normalize-stderr-test ".*/(rust|checkout)/library/" -> "RUSTLIB/"
// normalize-stderr-test "RUSTLIB/(.*):\d+:\d+ "-> "RUSTLIB/$1:LL:COL "
// normalize-stderr-test "::<.*>" -> ""
// compile-flags: -Zmiri-disable-isolation
#![feature(backtrace)]
use std::backtrace::Backtrace;
#[inline(never)] fn func_a() -> Backtrace { func_b::<u8>() }
#[inline(never)] fn func_b<T>() -> Backtrace { func_c() }
macro_rules! invoke_func_d {
() => { func_d() }
}
#[inline(never)] fn func_c() -> Backtrace { invoke_func_d!() }
#[inline(never)] fn func_d() -> Backtrace { Backtrace::capture() }
fn main() {
eprint!("{}", func_a());
}

View File

@ -0,0 +1,28 @@
0: func_d
at $DIR/backtrace-std.rs:18
1: func_c
at $DIR/backtrace-std.rs:17
2: func_b
at $DIR/backtrace-std.rs:11
3: func_a
at $DIR/backtrace-std.rs:10
4: main
at $DIR/backtrace-std.rs:21
5: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
RUSTLIB/core/src/ops/function.rs:227
6: std::sys_common::backtrace::__rust_begin_short_backtrace
RUSTLIB/std/src/sys_common/backtrace.rs:125
7: std::rt::lang_start::{closure#0}
RUSTLIB/std/src/rt.rs:66
8: std::ops::function::impls::call_once
RUSTLIB/core/src/ops/function.rs:259
9: std::panicking::r#try::do_call
RUSTLIB/std/src/panicking.rs:381
10: std::panicking::r#try
RUSTLIB/std/src/panicking.rs:345
11: std::panic::catch_unwind
RUSTLIB/std/src/panic.rs:382
12: std::rt::lang_start_internal
RUSTLIB/std/src/rt.rs:51
13: std::rt::lang_start
RUSTLIB/std/src/rt.rs:65