Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7f4f607

Browse files
committed
Auto merge of rust-lang#2177 - DrMeepster:global_allocator_backtrace_test, r=RalfJung
add test for backtrace with global allocator closes rust-lang#1996
2 parents 232260b + 0b7a148 commit 7f4f607

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

tests/pass/backtrace-global-alloc.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// compile-flags: -Zmiri-disable-isolation
2+
3+
#![feature(backtrace)]
4+
5+
use std::alloc::System;
6+
use std::backtrace::Backtrace;
7+
8+
#[global_allocator]
9+
static GLOBAL_ALLOCATOR: System = System;
10+
11+
fn main() {
12+
eprint!("{}", Backtrace::capture());
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
0: main
2+
at $DIR/backtrace-global-alloc.rs:LL:CC
3+
1: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
4+
at RUSTLIB/core/src/ops/function.rs:LL:CC
5+
2: std::sys_common::backtrace::__rust_begin_short_backtrace
6+
at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
7+
3: std::rt::lang_start::{closure#0}
8+
at RUSTLIB/std/src/rt.rs:LL:CC
9+
4: std::ops::function::impls::call_once
10+
at RUSTLIB/core/src/ops/function.rs:LL:CC
11+
5: std::panicking::r#try::do_call
12+
at RUSTLIB/std/src/panicking.rs:LL:CC
13+
6: std::panicking::r#try
14+
at RUSTLIB/std/src/panicking.rs:LL:CC
15+
7: std::panic::catch_unwind
16+
at RUSTLIB/std/src/panic.rs:LL:CC
17+
8: std::rt::lang_start_internal::{closure#2}
18+
at RUSTLIB/std/src/rt.rs:LL:CC
19+
9: std::panicking::r#try::do_call
20+
at RUSTLIB/std/src/panicking.rs:LL:CC
21+
10: std::panicking::r#try
22+
at RUSTLIB/std/src/panicking.rs:LL:CC
23+
11: std::panic::catch_unwind
24+
at RUSTLIB/std/src/panic.rs:LL:CC
25+
12: std::rt::lang_start_internal
26+
at RUSTLIB/std/src/rt.rs:LL:CC
27+
13: std::rt::lang_start
28+
at RUSTLIB/std/src/rt.rs:LL:CC

0 commit comments

Comments
 (0)