Skip to content

Commit

Permalink
Rollup merge of rust-lang#42141 - ids1024:nobacktrace, r=aturon
Browse files Browse the repository at this point in the history
Fix building std without backtrace feature, which was broken in ca8b754

Fixes rust-lang#42139
  • Loading branch information
frewsxcv authored May 24, 2017
2 parents 1b8377d + 66237af commit 078b253
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libstd/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ fn lang_start(main: fn(), argc: isize, argv: *const *const u8) -> isize {
use sys_common;
use sys_common::thread_info;
use thread::Thread;
#[cfg(not(feature = "backtrace"))]
use mem;

sys::init();

Expand All @@ -53,9 +55,12 @@ fn lang_start(main: fn(), argc: isize, argv: *const *const u8) -> isize {
sys::args::init(argc, argv);

// Let's run some code!
#[cfg(feature = "backtrace")]
let res = panic::catch_unwind(|| {
::sys_common::backtrace::__rust_begin_short_backtrace(main)
});
#[cfg(not(feature = "backtrace"))]
let res = panic::catch_unwind(mem::transmute::<_, fn()>(main));
sys_common::cleanup();
res.is_err()
};
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ impl Builder {
}
unsafe {
thread_info::set(imp::guard::current(), their_thread);
#[cfg(feature = "backtrace")]
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
::sys_common::backtrace::__rust_begin_short_backtrace(f)
}));
#[cfg(not(feature = "backtrace"))]
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f));
*their_packet.get() = Some(try_result);
}
};
Expand Down

0 comments on commit 078b253

Please sign in to comment.