Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
681bbd3
librustc: add "str" lang item
Dec 4, 2014
f63b8e4
librustc: use "str" lang item in `mk_str`/`mk_str_slice`
Dec 5, 2014
5c73c5d
librustc[_trans]: fix fallout of changing `mk_str_slice` signature
Dec 5, 2014
c977921
librustc: add `is_str` utility function
Dec 5, 2014
c00d178
librustc: kill `ty_str`
Dec 5, 2014
b00cc6b
librustc_trans: kill `ty_str`
Dec 5, 2014
b4b2551
libsyntax: kill `TyStr`
Dec 5, 2014
10b2f55
librustc: kill `TyStr`
Dec 5, 2014
a55ae0e
libsyntax: use the full path of `str` in `format_args!`
Dec 5, 2014
2727aa1
libcore: use full path of `str` in `panic!` macro
Dec 5, 2014
52cae4c
libcore: make `str` a library type
Dec 5, 2014
6e5f5d9
libunicode: fix fallout
Dec 5, 2014
8608ac7
librand: fix fallout
Dec 5, 2014
8ad9238
libcollections: fix fallout
Dec 5, 2014
be8c54c
librustrt: fix fallout
Dec 5, 2014
31a3b28
libstd: use full path of `str` in `panic!` macro
Dec 5, 2014
e373977
libstd: fix fallout
Dec 5, 2014
005cdb7
libfmt_macros: fix fallout
Dec 5, 2014
54c55cf
libserialize: fix fallout
Dec 5, 2014
7f6b844
librbml: fix fallout
Dec 5, 2014
adab4be
libsyntax: fix fallout
Dec 5, 2014
bd7ccae
librustc_back: fix fallout
Dec 6, 2014
1174f1c
librustc: fix fallout
Dec 6, 2014
d3d5374
librustc_trans: fix fallout
Dec 6, 2014
99fb6c1
librustdoc: kill `ty_str` and `TyStr`
Dec 6, 2014
d11d28d
librustdoc: fix fallout
Dec 6, 2014
ca8649f
compiletest: fix fallout
Dec 6, 2014
c73df95
Fix run-pass tests
Dec 6, 2014
fd0a965
FIXME I broke run-pass/unsized3
Dec 6, 2014
c373b72
Fix compile-fail tests
Dec 6, 2014
ce37ad9
libstd: fix unit tests
Dec 6, 2014
47fb373
libcollections: fix unit tests
Dec 6, 2014
d49859f
libgraphviz: fix unit tests
Dec 6, 2014
702031c
libsyntax: fix unit tests
Dec 6, 2014
de8d4a4
libserialize: fix doc tests
Dec 6, 2014
f53120d
Fix bench
Dec 6, 2014
7620208
Fix guides
Dec 6, 2014
80ca6e5
Fix pretty test
Dec 6, 2014
cebddbb
libstd: fix fallout
Dec 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
libcore: use full path of str in panic! macro
  • Loading branch information
Jorge Aparicio committed Dec 6, 2014
commit 2727aa11cef354cdb583d7534f6c21d9edc896f3
40 changes: 40 additions & 0 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#![macro_escape]

// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
/// Entry point of task panic, for details, see std::macros
#[macro_export]
macro_rules! panic(
Expand Down Expand Up @@ -46,6 +48,44 @@ macro_rules! panic(
});
)

#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
/// Entry point of task panic, for details, see std::macros
#[macro_export]
macro_rules! panic(
() => (
panic!("{}", "explicit panic")
);
($msg:expr) => ({
static _MSG_FILE_LINE: (&'static ::std::str::str, &'static ::std::str::str, uint) =
($msg, file!(), line!());
::core::panicking::panic(&_MSG_FILE_LINE)
});
($fmt:expr, $($arg:tt)*) => ({
// a closure can't have return type !, so we need a full
// function to pass to format_args!, *and* we need the
// file and line numbers right here; so an inner bare fn
// is our only choice.
//
// LLVM doesn't tend to inline this, presumably because begin_unwind_fmt
// is #[cold] and #[inline(never)] and because this is flagged as cold
// as returning !. We really do want this to be inlined, however,
// because it's just a tiny wrapper. Small wins (156K to 149K in size)
// were seen when forcing this to be inlined, and that number just goes
// up with the number of calls to panic!()
//
// The leading _'s are to avoid dead code warnings if this is
// used inside a dead function. Just `#[allow(dead_code)]` is
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
#[inline(always)]
fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
static _FILE_LINE: (&'static ::std::str::str, uint) = (file!(), line!());
::core::panicking::panic_fmt(fmt, &_FILE_LINE)
}
format_args!(_run_fmt, $fmt, $($arg)*)
});
)

/// Runtime assertion, for details see std::macros
#[macro_export]
macro_rules! assert(
Expand Down