Skip to content

Test std backtrace type #1584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/run-pass/backtrace-std.rs
Original file line number Diff line number Diff line change
@@ -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());
}
28 changes: 28 additions & 0 deletions tests/run-pass/backtrace-std.stderr
Original file line number Diff line number Diff line change
@@ -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