diff options
| author | bors <bors@rust-lang.org> | 2018-08-22 22:08:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-22 22:08:03 +0000 |
| commit | 917945d662c42053383fe3e71cb0f313d585e459 (patch) | |
| tree | 5a1fc5d8f5be9e7a429cb264a914150975a5ada6 /src/libstd | |
| parent | f1b506af022fdcb054aa90da1fbcf8c0226292d0 (diff) | |
| parent | bd6ae6a6d10f3ebe51d0a7a8d7ef342a65f68ff4 (diff) | |
| download | rust-917945d662c42053383fe3e71cb0f313d585e459.tar.gz rust-917945d662c42053383fe3e71cb0f313d585e459.zip | |
Auto merge of #52011 - oli-obk:dont_you_hate_it_too_when_everything_panics_constantly, r=eddyb
Allow panicking with string literal messages inside constants
r? @eddyb
cc https://github.com/rust-lang/rust/issues/51999
we can't implement things like `panic!("foo: {}", x)` right now because we can't call trait methods (most notably `Display::fmt`) inside constants. Also most of these impls probably have loops and conditions, so it's messy anyway.
But hey `panic!("foo")` works at least.
cc @japaric got any test ideas for `#![no_std]`?
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/panicking.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 283fd36af41..862f0fd71b0 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -397,6 +397,7 @@ fn continue_panic_fmt(info: &PanicInfo) -> ! { #[unstable(feature = "libstd_sys_internals", reason = "used by the panic! macro", issue = "0")] +#[cfg_attr(not(any(stage0, test)), lang = "begin_panic")] #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u32)) -> ! { // Note that this should be the only allocation performed in this code path. |
