@@ -204,22 +204,32 @@ impl FailWithCause for &'static str {
204
204
#[ cfg( stage0) ]
205
205
pub fn begin_unwind ( msg : ~str , file : ~str , line : uint ) -> ! {
206
206
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 ) -> ! {
207
220
use rt:: { context, OldTaskContext } ;
208
221
use rt:: local_services:: unsafe_borrow_local_services;
209
222
210
223
match context ( ) {
211
224
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 ( ( ) )
220
229
}
221
230
}
222
231
_ => {
232
+ // XXX: Need to print the failure message
223
233
gc:: cleanup_stack_for_failure ( ) ;
224
234
unsafe {
225
235
let local_services = unsafe_borrow_local_services ( ) ;
@@ -232,15 +242,6 @@ pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! {
232
242
}
233
243
}
234
244
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
-
244
245
// NOTE: remove function after snapshot
245
246
#[ cfg( stage0) ]
246
247
pub fn fail_assert ( msg : & str , file : & str , line : uint ) -> ! {
0 commit comments