diff options
| author | Brian Brooks <brooks.brian@gmail.com> | 2015-02-21 17:26:29 -0500 |
|---|---|---|
| committer | Brian Brooks <brooks.brian@gmail.com> | 2015-02-21 17:26:29 -0500 |
| commit | fc9fa1a563c48cc928c8c5754597ffba6f53a635 (patch) | |
| tree | c8b6dce437b1f392a9508ffa32b4538c553794b7 /src/libcore/macros.rs | |
| parent | 1212fd8abc7602f6c506c936908a799c76549a14 (diff) | |
| download | rust-fc9fa1a563c48cc928c8c5754597ffba6f53a635.tar.gz rust-fc9fa1a563c48cc928c8c5754597ffba6f53a635.zip | |
Resolve barriers to changing column!() / line!() return type to u32 in #19284 . Address review comments in #21769 .
Diffstat (limited to 'src/libcore/macros.rs')
| -rw-r--r-- | src/libcore/macros.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index d02ed7c2538..92d50821592 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -15,8 +15,10 @@ macro_rules! panic { panic!("explicit panic") ); ($msg:expr) => ({ - static _MSG_FILE_LINE: (&'static str, &'static str, usize) = - ($msg, file!(), line!() as usize); + #[cfg(stage0)] + static _MSG_FILE_LINE: (&'static str, &'static str, usize) = ($msg, file!(), line!()); + #[cfg(not(stage0))] + static _MSG_FILE_LINE: (&'static str, &'static str, u32) = ($msg, file!(), line!()); ::core::panicking::panic(&_MSG_FILE_LINE) }); ($fmt:expr, $($arg:tt)*) => ({ @@ -24,7 +26,10 @@ 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, usize) = (file!(), line!() as usize); + #[cfg(stage0)] + static _FILE_LINE: (&'static str, usize) = (file!(), line!()); + #[cfg(not(stage0))] + static _FILE_LINE: (&'static str, u32) = (file!(), line!()); ::core::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE) }); } |
