Skip to content

Commit

Permalink
std: move sys_common::backtrace to sys
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed Jun 16, 2024
1 parent 6832ad3 commit 89b5784
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion std/src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ use crate::fmt;
use crate::panic::UnwindSafe;
use crate::sync::atomic::{AtomicU8, Ordering::Relaxed};
use crate::sync::LazyLock;
use crate::sys_common::backtrace::{lock, output_filename, set_image_base};
use crate::sys::backtrace::{lock, output_filename, set_image_base};

/// A captured OS thread stack backtrace.
///
Expand Down
2 changes: 1 addition & 1 deletion std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl<E> Report<E> {
/// 1: rust_out::main::_doctest_main_src_error_rs_1158_0
/// 2: rust_out::main
/// 3: core::ops::function::FnOnce::call_once
/// 4: std::sys_common::backtrace::__rust_begin_short_backtrace
/// 4: std::sys::backtrace::__rust_begin_short_backtrace
/// 5: std::rt::lang_start::{{closure}}
/// 6: std::panicking::try
/// 7: std::rt::lang_start_internal
Expand Down
6 changes: 3 additions & 3 deletions std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::mem::{self, ManuallyDrop};
use crate::process;
use crate::sync::atomic::{AtomicBool, Ordering};
use crate::sync::{PoisonError, RwLock};
use crate::sys::backtrace;
use crate::sys::stdio::panic_output;
use crate::sys_common::backtrace;
use crate::thread;

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

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

let loc = Location::caller();
crate::sys_common::backtrace::__rust_end_short_backtrace(move || {
crate::sys::backtrace::__rust_end_short_backtrace(move || {
rust_panic_with_hook(
&mut Payload { inner: Some(msg) },
loc,
Expand Down
2 changes: 1 addition & 1 deletion std/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn lang_start<T: crate::process::Termination + 'static>(
sigpipe: u8,
) -> isize {
let Ok(v) = lang_start_internal(
&move || crate::sys_common::backtrace::__rust_begin_short_backtrace(main).report().to_i32(),
&move || crate::sys::backtrace::__rust_begin_short_backtrace(main).report().to_i32(),
argc,
argv,
sigpipe,
Expand Down
4 changes: 2 additions & 2 deletions std/src/sys_common/backtrace.rs → std/src/sys/backtrace.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Common code for printing backtraces.
use crate::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt};
use crate::borrow::Cow;
/// Common code for printing the backtrace in the same way across the different
/// supported platforms.
use crate::env;
use crate::fmt;
use crate::io;
Expand Down
1 change: 1 addition & 0 deletions std/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod pal;

mod personality;

pub mod backtrace;
pub mod cmath;
pub mod os_str;
pub mod path;
Expand Down
1 change: 0 additions & 1 deletion std/src/sys_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#[cfg(test)]
mod tests;

pub mod backtrace;
pub mod fs;
pub mod io;
pub mod lazy_box;
Expand Down
2 changes: 1 addition & 1 deletion std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ impl Builder {
let f = f.into_inner();
set_current(their_thread);
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
crate::sys_common::backtrace::__rust_begin_short_backtrace(f)
crate::sys::backtrace::__rust_begin_short_backtrace(f)
}));
// SAFETY: `their_packet` as been built just above and moved by the
// closure (it is an Arc<...>) and `my_packet` will be stored in the
Expand Down

0 comments on commit 89b5784

Please sign in to comment.