| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
Fixes https://github.com/rust-lang/rust/issues/51768.
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
This enables PanicInfo’s Display impl to show the panic message in those cases.
|
|
Due to being in libcore,
this impl cannot access PanicInfo::payload if it’s a String.
|
|
|
|
Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html
|