Skip to content

Commit 7092d8d

Browse files
committed
---
yaml --- r: 125960 b: refs/heads/try c: f7ab07c h: refs/heads/master v: v3
1 parent 30b0f37 commit 7092d8d

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: 4636b32a42ea3111f53048197092e7ac08e6f792
5+
refs/heads/try: f7ab07c7806bb4a7418f228c1cf266cdf011a878
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ macro_rules! fail(
3333
// up with the number of calls to fail!()
3434
#[inline(always)]
3535
fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
36-
::core::failure::begin_unwind(fmt, &(file!(), line!()))
36+
static file_line: (&'static str, uint) = (file!(), line!());
37+
::core::failure::begin_unwind(fmt, &file_line)
3738
}
3839
format_args!(run_fmt, $fmt, $($arg)*)
3940
});

branches/try/src/libstd/macros.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@
3838
/// ```
3939
#[macro_export]
4040
macro_rules! fail(
41-
() => (
42-
::std::rt::begin_unwind_no_time_to_explain(&(file!(), line!()))
43-
);
44-
($msg:expr) => (
45-
::std::rt::begin_unwind($msg, file!(), line!())
46-
);
41+
() => ({
42+
// static requires less code at runtime, more constant data
43+
static file_line: (&'static str, uint) = (file!(), line!());
44+
::std::rt::begin_unwind_no_time_to_explain(&file_line)
45+
});
46+
($msg:expr) => ({
47+
static file_line: (&'static str, uint) = (file!(), line!());
48+
let (file, line) = file_line;
49+
::std::rt::begin_unwind($msg, file, line)
50+
});
4751
($fmt:expr, $($arg:tt)*) => ({
4852
// a closure can't have return type !, so we need a full
4953
// function to pass to format_args!, *and* we need the
@@ -58,7 +62,8 @@ macro_rules! fail(
5862
// up with the number of calls to fail!()
5963
#[inline(always)]
6064
fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
61-
::std::rt::begin_unwind_fmt(fmt, &(file!(), line!()))
65+
static file_line: (&'static str, uint) = (file!(), line!());
66+
::std::rt::begin_unwind_fmt(fmt, &file_line)
6267
}
6368
format_args!(run_fmt, $fmt, $($arg)*)
6469
});

0 commit comments

Comments
 (0)