Skip to content

Commit cf9510c

Browse files
committed
std: move sys_common::backtrace to sys
1 parent 12b33d3 commit cf9510c

23 files changed

+27
-27
lines changed

library/std/src/backtrace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ use crate::fmt;
9595
use crate::panic::UnwindSafe;
9696
use crate::sync::atomic::{AtomicU8, Ordering::Relaxed};
9797
use crate::sync::LazyLock;
98-
use crate::sys_common::backtrace::{lock, output_filename, set_image_base};
98+
use crate::sys::backtrace::{lock, output_filename, set_image_base};
9999

100100
/// A captured OS thread stack backtrace.
101101
///

library/std/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<E> Report<E> {
429429
/// 1: rust_out::main::_doctest_main_src_error_rs_1158_0
430430
/// 2: rust_out::main
431431
/// 3: core::ops::function::FnOnce::call_once
432-
/// 4: std::sys_common::backtrace::__rust_begin_short_backtrace
432+
/// 4: std::sys::backtrace::__rust_begin_short_backtrace
433433
/// 5: std::rt::lang_start::{{closure}}
434434
/// 6: std::panicking::try
435435
/// 7: std::rt::lang_start_internal

library/std/src/panicking.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use crate::mem::{self, ManuallyDrop};
1919
use crate::process;
2020
use crate::sync::atomic::{AtomicBool, Ordering};
2121
use crate::sync::{PoisonError, RwLock};
22+
use crate::sys::backtrace;
2223
use crate::sys::stdio::panic_output;
23-
use crate::sys_common::backtrace;
2424
use crate::thread;
2525

2626
#[cfg(not(test))]
@@ -655,7 +655,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
655655

656656
let loc = info.location().unwrap(); // The current implementation always returns Some
657657
let msg = info.message();
658-
crate::sys_common::backtrace::__rust_end_short_backtrace(move || {
658+
crate::sys::backtrace::__rust_end_short_backtrace(move || {
659659
if let Some(s) = msg.as_str() {
660660
rust_panic_with_hook(
661661
&mut StaticStrPayload(s),
@@ -727,7 +727,7 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
727727
}
728728

729729
let loc = Location::caller();
730-
crate::sys_common::backtrace::__rust_end_short_backtrace(move || {
730+
crate::sys::backtrace::__rust_end_short_backtrace(move || {
731731
rust_panic_with_hook(
732732
&mut Payload { inner: Some(msg) },
733733
loc,

library/std/src/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn lang_start<T: crate::process::Termination + 'static>(
156156
sigpipe: u8,
157157
) -> isize {
158158
let Ok(v) = lang_start_internal(
159-
&move || crate::sys_common::backtrace::__rust_begin_short_backtrace(main).report().to_i32(),
159+
&move || crate::sys::backtrace::__rust_begin_short_backtrace(main).report().to_i32(),
160160
argc,
161161
argv,
162162
sigpipe,

library/std/src/sys_common/backtrace.rs library/std/src/sys/backtrace.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
//! Common code for printing backtraces.
2+
13
use crate::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt};
24
use crate::borrow::Cow;
3-
/// Common code for printing the backtrace in the same way across the different
4-
/// supported platforms.
55
use crate::env;
66
use crate::fmt;
77
use crate::io;

library/std/src/sys/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod pal;
55

66
mod personality;
77

8+
pub mod backtrace;
89
pub mod cmath;
910
pub mod os_str;
1011
pub mod path;

library/std/src/sys_common/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#[cfg(test)]
2121
mod tests;
2222

23-
pub mod backtrace;
2423
pub mod fs;
2524
pub mod io;
2625
pub mod lazy_box;

library/std/src/thread/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl Builder {
539539
let f = f.into_inner();
540540
set_current(their_thread);
541541
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
542-
crate::sys_common::backtrace::__rust_begin_short_backtrace(f)
542+
crate::sys::backtrace::__rust_begin_short_backtrace(f)
543543
}));
544544
// SAFETY: `their_packet` as been built just above and moved by the
545545
// closure (it is an Arc<...>) and `my_packet` will be stored in the

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | ABORT();
1616
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1717
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
19-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
19+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
2020
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
2121
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
2222
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC

src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | ABORT();
1616
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1717
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
19-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
19+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
2020
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
2121
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
2222
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC

src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | ABORT();
1313
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1414
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
16-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
16+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1717
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
1919
note: inside `main`

src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | ABORT();
1313
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1414
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
16-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
16+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1717
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
1919
note: inside `main`

src/tools/miri/tests/fail/panic/double_panic.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL | ABORT();
1818
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1919
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2020
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
21-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
21+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
2222
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
2323
= note: inside `core::panicking::panic_nounwind_nobacktrace` at RUSTLIB/core/src/panicking.rs:LL:CC
2424
= note: inside `core::panicking::panic_in_cleanup` at RUSTLIB/core/src/panicking.rs:LL:CC

src/tools/miri/tests/fail/panic/panic_abort1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | ABORT();
1414
= note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
17-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
17+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1818
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1919
note: inside `main`
2020
--> $DIR/panic_abort1.rs:LL:CC

src/tools/miri/tests/fail/panic/panic_abort2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | ABORT();
1414
= note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
17-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
17+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1818
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1919
note: inside `main`
2020
--> $DIR/panic_abort2.rs:LL:CC

src/tools/miri/tests/fail/panic/panic_abort3.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | ABORT();
1414
= note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
17-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
17+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1818
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1919
note: inside `main`
2020
--> $DIR/panic_abort3.rs:LL:CC

src/tools/miri/tests/fail/panic/panic_abort4.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | ABORT();
1414
= note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
17-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
17+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1818
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
1919
note: inside `main`
2020
--> $DIR/panic_abort4.rs:LL:CC

src/tools/miri/tests/fail/terminate-terminator.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL | ABORT();
1818
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1919
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
2020
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
21-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
21+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
2222
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
2323
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
2424
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC

src/tools/miri/tests/fail/unwind-action-terminate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | ABORT();
1616
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1717
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
19-
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
19+
= note: inside `std::sys::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
2020
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
2121
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
2222
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC

src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $DIR/backtrace-api-v0.rs:LL:CC (func_b)
44
$DIR/backtrace-api-v0.rs:LL:CC (func_a)
55
$DIR/backtrace-api-v0.rs:LL:CC (main)
66
RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
7-
RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
7+
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::__rust_begin_short_backtrace)
88
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0})
99
RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once)
1010
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)

src/tools/miri/tests/pass/backtrace/backtrace-api-v1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $DIR/backtrace-api-v1.rs:LL:CC (func_b)
44
$DIR/backtrace-api-v1.rs:LL:CC (func_a)
55
$DIR/backtrace-api-v1.rs:LL:CC (main)
66
RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
7-
RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC (std::sys_common::backtrace::__rust_begin_short_backtrace)
7+
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::__rust_begin_short_backtrace)
88
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0})
99
RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once)
1010
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call)

src/tools/miri/tests/pass/backtrace/backtrace-global-alloc.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
at $DIR/backtrace-global-alloc.rs:LL:CC
33
1: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
44
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
5+
2: std::sys::backtrace::__rust_begin_short_backtrace
6+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
77
3: std::rt::lang_start::{closure#0}
88
at RUSTLIB/std/src/rt.rs:LL:CC
99
4: std::ops::function::impls::call_once

src/tools/miri/tests/pass/backtrace/backtrace-std.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
at $DIR/backtrace-std.rs:LL:CC
1111
5: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
1212
at RUSTLIB/core/src/ops/function.rs:LL:CC
13-
6: std::sys_common::backtrace::__rust_begin_short_backtrace
14-
at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
13+
6: std::sys::backtrace::__rust_begin_short_backtrace
14+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
1515
7: std::rt::lang_start::{closure#0}
1616
at RUSTLIB/std/src/rt.rs:LL:CC
1717
8: std::ops::function::impls::call_once

0 commit comments

Comments
 (0)