about summary refs log tree commit diff
path: root/src/libcore/panic.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-361/+0
2020-07-27Auto merge of #73583 - anp:location-eq, r=dtolnaybors-1/+23
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
2020-07-19Clarify core::panic::Location's docs on ordering.Adam Perry-3/+3
Co-authored-by: Simon Sapin <simon.sapin@exyr.org>
2020-06-30Stabilize `#[track_caller]`.Adam Perry-10/+4
Does not yet make its constness stable, though. Use of `Location::caller` in const contexts is still gated by `#![feature(const_caller_location)]`.
2020-06-29Derive common traits for panic::Location.Adam Perry-1/+23
Add documentation about the host/target behavior of Location::file.
2020-06-15Join mutiple lines if it is more readableLzu Tao-6/+3
2020-04-29document stable counterparts of intrinsicsBastian Kauschke-0/+2
2020-04-24Improve PanicInfo examples readabilityGuillaume Gomez-3/+9
2019-12-22Format the worldMark Rousskov-17/+21
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-4/+4
2019-12-18Propagate cfg bootstrapMark Rousskov-1/+0
2019-12-16Rollup merge of #66771 - SimonSapin:panic-stability, r=KodrAusMazdak Farrokhzad-8/+10
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
2019-12-05Implement core::panic::Location::caller using #[track_caller].Adam Perry-0/+54
2019-11-26Stabilize the `core::panic` moduleSimon Sapin-3/+1
`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
2019-11-26Fix the tracking issue number for `PanicInfo::message`Simon Sapin-1/+1
#44489 was closed when the `#[panic_handler]` attribute was stabilized.
2019-11-26abort on BoxMeUp misuseRalf Jung-0/+8
2019-11-26Fix unstable attribute accidentally applying to the entire implSimon Sapin-4/+8
Note `#![unstable]` v.s. `#[unstable]`
2019-11-25better comment and rename BoxMeUp::box_me_up to take_boxRalf Jung-1/+3
2019-11-12Snap cfgsMark Rousskov-1/+1
2019-10-27Panicking infra uses &core::panic::Location.Adam Perry-6/+11
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-27Implement core::intrinsics::caller_location.Adam Perry-0/+1
Returns a `&core::panic::Location` corresponding to where it was called, also making `Location` a lang item.
2019-04-19libcore: deny more...Mazdak Farrokhzad-4/+4
2019-04-18libcore => 2018Taiki Endo-2/+2
2018-12-25Remove licensesMark Rousskov-10/+0
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-2/+2
2018-07-25Enforce #![deny(bare_trait_objects)] in src/libcoreljedrz-5/+5
2018-07-10Avoid unwrapping in PanicInfo doc example.Corey Farwell-1/+5
Fixes https://github.com/rust-lang/rust/issues/51768.
2018-06-30Bootstrap from 1.28.0-beta.3Mark Simulacrum-1/+1
2018-06-03implement #[panic_implementation]Jorge Aparicio-2/+4
2018-04-13std: Avoid allocating panic message unless neededAlex Crichton-4/+10
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-13std: Minimize size of panicking on wasmAlex Crichton-0/+10
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-05Correct a few stability attributesOliver Middleton-0/+2
2018-01-24Add missing micro version number component in stability attributes.Simon Sapin-1/+1
2018-01-23Make PanicInfo::message available for std::panic! with a formatting string.Simon Sapin-2/+2
This enables PanicInfo’s Display impl to show the panic message in those cases.
2018-01-23Implement Display for PanicInfo and LocationSimon Sapin-0/+23
Due to being in libcore, this impl cannot access PanicInfo::payload if it’s a String.
2018-01-23Add an unstable PanicInfo::message(&self) -> Option<&fmt::Arguments> methodSimon Sapin-2/+17
2018-01-23Move PanicInfo and Location to libcoreSimon Sapin-0/+213
Per https://rust-lang.github.io/rfcs/2070-panic-implementation.html