1
Fork 0

std: Use correct conventions for statics in macros

This commit is contained in:
Brian Anderson 2014-07-25 15:54:56 -07:00
parent a43e7d5cb9
commit cf7a89f0c0

View file

@ -40,12 +40,12 @@
macro_rules! fail( macro_rules! fail(
() => ({ () => ({
// static requires less code at runtime, more constant data // static requires less code at runtime, more constant data
static file_line: (&'static str, uint) = (file!(), line!()); static FILE_LINE: (&'static str, uint) = (file!(), line!());
::std::rt::begin_unwind_no_time_to_explain(&file_line) ::std::rt::begin_unwind_no_time_to_explain(&FILE_LINE)
}); });
($msg:expr) => ({ ($msg:expr) => ({
static file_line: (&'static str, uint) = (file!(), line!()); static FILE_LINE: (&'static str, uint) = (file!(), line!());
let (file, line) = file_line; let (file, line) = FILE_LINE;
::std::rt::begin_unwind($msg, file, line) ::std::rt::begin_unwind($msg, file, line)
}); });
($fmt:expr, $($arg:tt)*) => ({ ($fmt:expr, $($arg:tt)*) => ({
@ -62,8 +62,8 @@ macro_rules! fail(
// up with the number of calls to fail!() // up with the number of calls to fail!()
#[inline(always)] #[inline(always)]
fn run_fmt(fmt: &::std::fmt::Arguments) -> ! { fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
static file_line: (&'static str, uint) = (file!(), line!()); static FILE_LINE: (&'static str, uint) = (file!(), line!());
::std::rt::begin_unwind_fmt(fmt, &file_line) ::std::rt::begin_unwind_fmt(fmt, &FILE_LINE)
} }
format_args!(run_fmt, $fmt, $($arg)*) format_args!(run_fmt, $fmt, $($arg)*)
}); });