Auto merge of #2177 - DrMeepster:global_allocator_backtrace_test, r=RalfJung

add test for backtrace with global allocator

closes #1996
This commit is contained in:
bors 2022-06-02 11:37:11 +00:00
commit 7f4f6072aa
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// compile-flags: -Zmiri-disable-isolation
#![feature(backtrace)]
use std::alloc::System;
use std::backtrace::Backtrace;
#[global_allocator]
static GLOBAL_ALLOCATOR: System = System;
fn main() {
eprint!("{}", Backtrace::capture());
}

View File

@ -0,0 +1,28 @@
0: main
at $DIR/backtrace-global-alloc.rs:LL:CC
1: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
at RUSTLIB/core/src/ops/function.rs:LL:CC
2: std::sys_common::backtrace::__rust_begin_short_backtrace
at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
3: std::rt::lang_start::{closure#0}
at RUSTLIB/std/src/rt.rs:LL:CC
4: std::ops::function::impls::call_once
at RUSTLIB/core/src/ops/function.rs:LL:CC
5: std::panicking::r#try::do_call
at RUSTLIB/std/src/panicking.rs:LL:CC
6: std::panicking::r#try
at RUSTLIB/std/src/panicking.rs:LL:CC
7: std::panic::catch_unwind
at RUSTLIB/std/src/panic.rs:LL:CC
8: std::rt::lang_start_internal::{closure#2}
at RUSTLIB/std/src/rt.rs:LL:CC
9: std::panicking::r#try::do_call
at RUSTLIB/std/src/panicking.rs:LL:CC
10: std::panicking::r#try
at RUSTLIB/std/src/panicking.rs:LL:CC
11: std::panic::catch_unwind
at RUSTLIB/std/src/panic.rs:LL:CC
12: std::rt::lang_start_internal
at RUSTLIB/std/src/rt.rs:LL:CC
13: std::rt::lang_start
at RUSTLIB/std/src/rt.rs:LL:CC