Skip to content

Commit f8dffc6

Browse files
committed
core: Wire up the unwinder to newsched again
This was some merge fallout
1 parent db6a62c commit f8dffc6

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/libcore/sys.rs

+18-17
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,32 @@ impl FailWithCause for &'static str {
204204
#[cfg(stage0)]
205205
pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! {
206206

207+
do str::as_buf(msg) |msg_buf, _msg_len| {
208+
do str::as_buf(file) |file_buf, _file_len| {
209+
unsafe {
210+
let msg_buf = cast::transmute(msg_buf);
211+
let file_buf = cast::transmute(file_buf);
212+
begin_unwind_(msg_buf, file_buf, line as libc::size_t)
213+
}
214+
}
215+
}
216+
}
217+
218+
// FIXME #4427: Temporary until rt::rt_fail_ goes away
219+
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
207220
use rt::{context, OldTaskContext};
208221
use rt::local_services::unsafe_borrow_local_services;
209222

210223
match context() {
211224
OldTaskContext => {
212-
do str::as_buf(msg) |msg_buf, _msg_len| {
213-
do str::as_buf(file) |file_buf, _file_len| {
214-
unsafe {
215-
let msg_buf = cast::transmute(msg_buf);
216-
let file_buf = cast::transmute(file_buf);
217-
begin_unwind_(msg_buf, file_buf, line as libc::size_t)
218-
}
219-
}
225+
unsafe {
226+
gc::cleanup_stack_for_failure();
227+
rustrt::rust_upcall_fail(msg, file, line);
228+
cast::transmute(())
220229
}
221230
}
222231
_ => {
232+
// XXX: Need to print the failure message
223233
gc::cleanup_stack_for_failure();
224234
unsafe {
225235
let local_services = unsafe_borrow_local_services();
@@ -232,15 +242,6 @@ pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! {
232242
}
233243
}
234244

235-
// FIXME #4427: Temporary until rt::rt_fail_ goes away
236-
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
237-
unsafe {
238-
gc::cleanup_stack_for_failure();
239-
rustrt::rust_upcall_fail(msg, file, line);
240-
cast::transmute(())
241-
}
242-
}
243-
244245
// NOTE: remove function after snapshot
245246
#[cfg(stage0)]
246247
pub fn fail_assert(msg: &str, file: &str, line: uint) -> ! {

0 commit comments

Comments
 (0)