Commit graph

21 commits

Author SHA1 Message Date
Ralf Jung
3e96ca2bf7 abort on BoxMeUp misuse 2019-11-26 09:24:39 +01:00
Ralf Jung
08f779cb4b better comment and rename BoxMeUp::box_me_up to take_box 2019-11-25 12:16:08 +01:00
Mark Rousskov
997feacddd Snap cfgs 2019-11-12 16:36:57 -05:00
Adam Perry
aec97e050e Panicking infra uses &core::panic::Location.
This allows us to remove `static_panic_msg` from the SSA<->LLVM
boundary, along with its fat pointer representation for &str.

Also changes the signature of PanicInfo::internal_contructor to
avoid copying.

Closes #65856.
2019-10-27 12:50:58 -07:00
Adam Perry
743964ad3f Implement core::intrinsics::caller_location.
Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.
2019-10-27 12:50:52 -07:00
Mazdak Farrokhzad
dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Taiki Endo
360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Scott McMurray
0a3bd9b6ab Use impl_header_lifetime_elision in libcore 2018-09-29 21:33:35 -07:00
ljedrz
8646a17143 Enforce #![deny(bare_trait_objects)] in src/libcore 2018-07-25 10:21:41 +09:00
Corey Farwell
d2fb2fb2a5 Avoid unwrapping in PanicInfo doc example.
Fixes https://github.com/rust-lang/rust/issues/51768.
2018-07-10 22:25:38 -04:00
Mark Simulacrum
ad97f8b491 Bootstrap from 1.28.0-beta.3 2018-06-30 13:17:49 -07:00
Jorge Aparicio
e44ad61a2d implement #[panic_implementation] 2018-06-03 13:46:19 +02:00
Alex Crichton
46d16b66e0 std: Avoid allocating panic message unless needed
This commit removes allocation of the panic message in instances like
`panic!("foo: {}", "bar")` if we don't actually end up needing the message. We
don't need it in the case of wasm32 right now, and in general it's not needed
for panic=abort instances that use the default panic hook.

For now this commit only solves the wasm use case where with LTO the allocation
is entirely removed, but the panic=abort use case can be implemented at a later
date if needed.
2018-04-13 07:04:24 -07:00
Alex Crichton
c3a5d6b130 std: Minimize size of panicking on wasm
This commit applies a few code size optimizations for the wasm target to
the standard library, namely around panics. We notably know that in most
configurations it's impossible for us to print anything in
wasm32-unknown-unknown so we can skip larger portions of panicking that
are otherwise simply informative. This allows us to get quite a nice
size reduction.

Finally we can also tweak where the allocation happens for the
`Box<Any>` that we panic with. By only allocating once unwinding starts
we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-04-13 07:03:00 -07:00
Oliver Middleton
521e41e77d Correct a few stability attributes 2018-04-05 15:39:29 +01:00
Simon Sapin
399dcd1127 Add missing micro version number component in stability attributes. 2018-01-24 22:25:42 +01:00
Simon Sapin
f15c816932 Make PanicInfo::message available for std::panic! with a formatting string.
This enables PanicInfo’s Display impl to show the panic message in those cases.
2018-01-23 18:31:09 +01:00
Simon Sapin
0e60287b41 Implement Display for PanicInfo and Location
Due to being in libcore,
this impl cannot access PanicInfo::payload if it’s a String.
2018-01-23 18:04:50 +01:00
Simon Sapin
9e96c1ef7f Add an unstable PanicInfo::message(&self) -> Option<&fmt::Arguments> method 2018-01-23 17:24:19 +01:00
Simon Sapin
2f98f4b12b Move PanicInfo and Location to libcore
Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html
2018-01-23 16:38:26 +01:00