about summary refs log tree commit diff
path: root/src/libstd/panic.rs
AgeCommit message (Collapse)AuthorLines
2016-05-24panic.rs: fix docs (recover -> catch_unwind)diwic-35/+35
The current docs are a bit inconsistent. First, change all references of "recover" to "catch_unwind" because the function was renamed. Second, consistently use the term "unwind safe" instead of "panic safe", "exception safe" and "recover safe" (all these terms were used previously).
2016-05-19Mention that the panic hook will always runSteven Fackler-1/+1
2016-05-16rename a few occurrences of RecoverSafe in docsRobert Habermeier-4/+4
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-6/+3
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-04-13Fix a typo and add a missing wordGeorg Brandl-2/+2
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-66/+156
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
2016-03-22try! -> ?Jorge Aparicio-1/+1
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-19Rollup merge of #32329 - sfackler:assert-recover-safe-pub, r=aturonEduard-Mihai Burtescu-3/+7
Make AssertRecoverSafe's field public It's basically the very definition of a newtype, so we might as well make things easy on people and let them construct and access it directly. r? @aturon
2016-03-18Fix tidySteven Fackler-2/+4
2016-03-18Add a since to deprecationsSteven Fackler-2/+2
2016-03-17Make AssertRecoverSafe's field publicSteven Fackler-3/+5
It's basically the very definition of a newtype, so we might as well make things easy on people and let them construct and access it directly.
2016-03-15Make set_hook take a Box<Fn>Steven Fackler-1/+1
Otherwise there's no good way of re-registering a hook you got out of take_hook.
2016-03-15Rename panic handlers to panic hookSteven Fackler-1/+15
2016-03-07std: Add impl of FnOnce to AssertRecoverSafeAlex Crichton-1/+35
This was originally intended, but forgot to land by accident! cc #27719
2016-02-17Add into_inner to AssertRecoverSafeAmanieu d'Antras-0/+6
2016-02-09Minor spelling fixesCarlos E. Garcia-1/+1
2016-01-16Fix typoGuillaume Gomez-1/+1
2016-01-07Auto merge of #30557 - sfackler:panic-propagate, r=aturonbors-0/+27
See rust-lang/rfcs#1413. r? @alexcrichton
2016-01-06Add std::panic::propagateSteven Fackler-0/+27
2016-01-02Grammar fixesJames Mantooth-6/+6
2015-12-25Rollup merge of #30513 - alexcrichton:assert-is-safe, r=aturonManish Goregaokar-15/+19
Types like `&AssertRecoverSafe<T>` and `Rc<AssertRecoverSafe<T>>` were mistakenly not considered recover safe, but the point of the assertion wrapper is that it indeed is! This was caused by an interaction between the `RecoverSafe` and `NoUnsafeCell` marker traits, and this is updated by adding an impl of the `NoUnsafeCell` marker trait for `AssertRecoverSafe` to ensure that it never interacts with the other negative impls of `RecoverSafe`. cc #30510
2015-12-23Implement custom panic handlersSteven Fackler-0/+2
2015-12-21std: Ensure AssertRecoverSafe indeed is more oftenAlex Crichton-15/+19
Types like `&AssertRecoverSafe<T>` and `Rc<AssertRecoverSafe<T>>` were mistakenly not considered recover safe, but the point of the assertion wrapper is that it indeed is! This was caused by an interaction between the `RecoverSafe` and `NoUnsafeCell` marker traits, and this is updated by adding an impl of the `NoUnsafeCell` marker trait for `AssertRecoverSafe` to ensure that it never interacts with the other negative impls of `RecoverSafe`. cc #30510
2015-12-09std: Rename thread::catch_panic to panic::recoverAlex Crichton-0/+255
This commit is an implementation of [RFC 1236] and [RFC 1323] which rename the `thread::catch_panic` function to `panic::recover` while also replacing the `Send + 'static` bounds with a new `PanicSafe` bound. [RFC 1236]: https://github.com/rust-lang/rfcs/pull/1236 [RFC 1323]: https://github.com/rust-lang/rfcs/pull/1323 cc #27719