| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Derive common traits for panic::Location.
Now that `#[track_caller]` is on track to stabilize, one of the roughest edges of working with it is the fact that you can't do much with `Location` except turn it back into a `(&str, u32, u32)`. Which makes sense because the type was defined around the panic machinery originally passing around that tuple (it has the same layout as Location even).
This PR derives common traits for the type in accordance with the [API guidelines](https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits) (those apply to core, right?).
There's a risk here, e.g. if we ever change the representation of `Location` in a way that makes it harder to implement `Ord`, we might not be able to make that change in a backwards-compatible way. I don't think there's any other compatibility hazard here, as the only changes we currently imagine for the type are to add end fields.
cc @rust-lang/libs
|
|
Co-authored-by: Simon Sapin <simon.sapin@exyr.org>
|
|
Does not yet make its constness stable, though. Use of
`Location::caller` in const contexts is still gated by
`#![feature(const_caller_location)]`.
|
|
Add documentation about the host/target behavior of Location::file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stabilize the `core::panic` module
`std::panic` is already stable.
`core::panic::PanicInfo` and `core::panic::Location` are stable and can be used through that path because of a bug in stability checking: #15702
|
|
|
|
`std::panic` is already stable.
`core::panic::PanicInfo` and `core::panic::Location` are stable
and can be used through that path because of a bug
in stability checking: https://github.com/rust-lang/rust/issues/15702
|
|
#44489 was closed when the `#[panic_handler]` attribute was stabilized.
|
|
|
|
Note `#![unstable]` v.s. `#[unstable]`
|
|
|
|
|
|
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.
|
|
Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.
|
|
|
|
|
|
|
|
|
|
|
|
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
|