diff options
| author | Fenrir <[email protected]> | 2017-07-24 19:48:21 -0600 |
|---|---|---|
| committer | Fenrir <[email protected]> | 2017-07-24 19:48:21 -0600 |
| commit | 59b0b6de00ea8212e9db455b588d0ff102680e3e (patch) | |
| tree | 91a000f90cd5194d6bdca7da565b7297ad39c43e /ctr-std | |
| parent | Fix missing stability attribute (diff) | |
| download | ctru-rs-59b0b6de00ea8212e9db455b588d0ff102680e3e.tar.xz ctru-rs-59b0b6de00ea8212e9db455b588d0ff102680e3e.zip | |
Update to new panic ABI
Diffstat (limited to 'ctr-std')
| -rw-r--r-- | ctr-std/src/macros.rs | 8 | ||||
| -rw-r--r-- | ctr-std/src/panicking.rs | 17 |
2 files changed, 13 insertions, 12 deletions
diff --git a/ctr-std/src/macros.rs b/ctr-std/src/macros.rs index 0ce6b0a..21a7da9 100644 --- a/ctr-std/src/macros.rs +++ b/ctr-std/src/macros.rs @@ -43,8 +43,8 @@ macro_rules! panic { ($msg:expr) => ({ $crate::rt::begin_panic($msg, { // static requires less code at runtime, more constant data - static _FILE_LINE: (&'static str, u32) = (file!(), line!()); - &_FILE_LINE + static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), column!()); + &_FILE_LINE_COL }) }); ($fmt:expr, $($arg:tt)+) => ({ @@ -53,8 +53,8 @@ macro_rules! panic { // used inside a dead function. Just `#[allow(dead_code)]` is // insufficient, since the user may have // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE: (&'static str, u32) = (file!(), line!()); - &_FILE_LINE + static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), column!()); + &_FILE_LINE_COL }) }); } diff --git a/ctr-std/src/panicking.rs b/ctr-std/src/panicking.rs index 57aa563..422eef7 100644 --- a/ctr-std/src/panicking.rs +++ b/ctr-std/src/panicking.rs @@ -33,8 +33,11 @@ pub extern fn eh_personality() {} /// Entry point of panic from the libcore crate. #[lang = "panic_fmt"] -pub extern fn rust_begin_panic(msg: fmt::Arguments, file: &'static str, line: u32) -> ! { - begin_panic_fmt(&msg, &(file, line)) +pub extern fn rust_begin_panic(msg: fmt::Arguments, + file: &'static str, + line: u32, + col: u32) -> ! { + begin_panic_fmt(&msg, &(file, line, col)) } /// The entry point for panicking with a formatted message. @@ -47,12 +50,12 @@ pub extern fn rust_begin_panic(msg: fmt::Arguments, file: &'static str, line: u3 reason = "used by the panic! macro", issue = "0")] #[inline(never)] #[cold] -pub fn begin_panic_fmt(msg: &fmt::Arguments, file_line: &(&'static str, u32)) -> ! { +pub fn begin_panic_fmt(msg: &fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! { use fmt::Write; let mut s = String::new(); let _ = s.write_fmt(*msg); - begin_panic(s, file_line); + begin_panic(s, file_line_col); } /// We don't have stack unwinding, so all we do is print the panic message @@ -61,11 +64,9 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments, file_line: &(&'static str, u32)) -> reason = "used by the panic! macro", issue = "0")] #[inline(never)] #[cold] -#[inline(never)] -#[cold] -pub fn begin_panic<M: Any + Send + Display>(msg: M, file_line: &(&'static str, u32)) -> ! { +pub fn begin_panic<M: Any + Send + Display>(msg: M, file_line_col: &(&'static str, u32, u32)) -> ! { let msg = Box::new(msg); - let (file, line) = *file_line; + let (file, line, col) = *file_line_col; use libctru::consoleInit; use libctru::gfxScreen_t; |