summary refs log tree commit diff
path: root/library/panic_unwind/src
AgeCommit message (Collapse)AuthorLines
2024-07-30Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68bors-1/+0
Bump bootstrap compiler to new beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28step cfg(bootstrap)Mark Rousskov-1/+0
2024-07-23Rollup merge of #125834 - ↵Matthias Krüger-0/+6
workingjubilee:weaken-thir-unsafeck-for-addr-of-static-mut, r=compiler-errors treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safe Fixes rust-lang/rust#125833 As reported in that and related issues, `static mut STATIC_MUT: T` is very often used in embedded code, and is in many ways equivalent to `static STATIC_CELL: SyncUnsafeCell<T>`. The Rust expression of `&raw mut STATIC_MUT` and `SyncUnsafeCell::get(&STATIC_CELL)` are approximately equal, and both evaluate to `*mut T`. The library function is safe because it has *declared itself* to be safe. However, the raw ref operator is unsafe because all uses of `static mut` are considered unsafe, even though the static's value is not used by this expression (unlike, for example, `&STATIC_MUT`). We can fix this unnatural difference by simply adding the proper exclusion for the safety check inside the THIR unsafeck, so that we do not declare it unsafe if it is not. While the primary concern here is `static mut`, this change is made for all instances of an "unsafe static", which includes a static declared inside `extern "abi" {}`. Hypothetically, we could go as far as generalizing this to all instances of `&raw (const|mut) *ptr`, but today we do not, as we have not actually considered the range of possible expressions that use a similar encoding. We do not even extend this to thread-local equivalents, because they have less clear semantics.
2024-07-22library: vary unsafety in bootstrapping for SEHJubilee Young-0/+6
2024-07-01Use the native unwind function in miri where possiblebjorn3-21/+13
2024-06-20Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgrbors-0/+1
Rollup of 7 pull requests Successful merges: - #126380 (Add std Xtensa targets support) - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s ) - #126659 (More status-quo tests for the `#[coverage(..)]` attribute) - #126711 (Make Option::as_[mut_]slice const) - #126717 (Clean up some comments near `use` declarations) - #126719 (Fix assertion failure for some `Expect` diagnostics.) - #126730 (Add opaque type corner case test) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+1
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-19Stabilise c_unwindGary Guo-1/+1
2024-04-14Replace libc::c_int with core::ffi::c_intChris Denton-1/+1
And remove the libc crate when it isn't needed
2024-04-11Refactor `panic_unwind/seh.rs` pointer use; x86 now conforms to ↵niluxv-41/+73
strict-provenance
2024-03-19SeqCst->Relaxed in panic_unwind/emcc.Mara Bos-1/+1
SeqCst is unnecessary here.
2024-03-11Rollup merge of #121438 - coolreader18:wasm32-panic-unwind, r=cuviperJubilee-2/+2
std support for wasm32 panic=unwind Tracking issue: #118168 This adds std support for `-Cpanic=unwind` on wasm, and with it slightly more fleshed out rustc support. Now, the stable default is still panic=abort without exception-handling, but if you `-Zbuild-std` with `RUSTFLAGS=-Cpanic=unwind`, you get wasm exception-handling try/catch blocks in the binary: ```rust #[no_mangle] pub fn foo_bar(x: bool) -> *mut u8 { let s = Box::<str>::from("hello"); maybe_panic(x); Box::into_raw(s).cast() } #[inline(never)] #[no_mangle] fn maybe_panic(x: bool) { if x { panic!("AAAAA"); } } ``` ```wat ;; snip... (try $label$5 (do (call $maybe_panic (local.get $0) ) (br $label$1) ) (catch_all (global.set $__stack_pointer (local.get $1) ) (call $__rust_dealloc (local.get $2) (i32.const 5) (i32.const 1) ) (rethrow $label$5) ) ) ;; snip... ```
2024-02-26miri: rename miri_start_panic → miri_start_unwindRalf Jung-3/+3
2024-02-23Get rid of some `#[allow(static_mut_refs)]`Pavel Grigorenko-22/+17
2024-02-22Use Itanium ABI for thrown exceptionsNoa-40/+2
2024-02-22Unconditionally pass -wasm-enable-ehNoa-6/+1
2024-02-22std support for wasm32 panic=unwindNoa-1/+44
2024-02-18Improve wording of static_mut_refObei Sideg-4/+6
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-08Step all bootstrap cfgs forwardMark Rousskov-2/+2
This also takes care of other bootstrap-related changes.
2024-01-07Update test for `E0796` and `static_mut_ref` lintObei Sideg-0/+4
2023-11-16panic_unwind: support unwinding on xousSean Cross-0/+1
Now that `unwind` supports Xous, enable unwinding panics on Xous. Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-10Use pointers instead of `usize` addresses for landing padsniluxv-1/+1
This bring unwind and personality code more in line with strict-provenance
2023-09-20Rename BoxMeUp to PanicPayload.Mara Bos-2/+2
2023-08-23Bump cfg(bootstrap)Mark Rousskov-2/+1
2023-08-07stabilize abi_thiscallBenedikt Radtke-1/+1
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-04-29Partial stabilisation of `c_unwind`Gary Guo-4/+4
2023-03-26Remove unnecessary raw pointer in __rust_start_panic argbjorn3-2/+2
It is no longer necessary as __rust_start_panic switched to the Rust abi.
2022-12-30Replace libstd, libcore, liballoc in docs.jonathanCogan-2/+2
2022-11-04Fix build of thumbv7a-pc-windows-msvcArlo Siemsen-1/+2
2022-10-23Fix alloc sizeGary Guo-2/+1
2022-10-23Apply suggestionGary Guo-1/+1
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2022-10-23Implement Rust foreign exception protection for EMCC and SEHGary Guo-15/+42
2022-10-23Prevent foreign Rust exceptions from being caughtGary Guo-3/+27
2022-08-28Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-577/+0
Move EH personality functions to std These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame. Fixes #41004
2022-08-23Use renamed atomic intrinsics in panic_unwindTomasz Miąsko-6/+9
2022-08-23Remove custom frame info registration on i686-pc-windows-gnuAmanieu d'Antras-37/+0
The indirection is no longer needed since we always link to libgcc even when the panic_abort runtime is used. Instead we can just call the libgcc functions directly.
2022-08-23Move personality functions to stdAmanieu d'Antras-540/+0
These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame.
2022-08-23Fix comment on the SEH personality functionAmanieu d'Antras-2/+2
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-1/+1
2022-07-30Fix unwinding when debug assertions are enabledMads Marquart-1/+3
This came up on armv7-apple-ios when using -Zbuild-std
2022-07-20Library changes for Apple WatchOSVladimir Michael Eatwell-1/+1
2022-06-09Add underscores to rust_eh_personality arguments to mark them as unusedHood Chatham-5/+5
2022-06-08Remove __gxx_personality_v0 declarationHood Chatham-7/+0
2022-06-08Fix formatterHood Chatham-1/+0
2022-06-08Don't use __gxx_personality_v0 in panic_unwind on emscripten targetHood Chatham-1/+6
This resolves #85821. See also the discussion here: https://github.com/emscripten-core/emscripten/issues/17128 The consensus seems to be that rust_eh_personality is never invoked. I patched __gxx_personality_v0 to log invocations and then ran various panic tests and it was never called, so this analysis matches what seems to happen in practice. This replaces the definition with an abort, modeled on the structured exception handling implementation.
2022-06-03Fully stabilize NLLJack Huey-1/+0
2022-05-14Use Rust ABI for `__rust_start_panic` and `_{rdl,rg}_oom`Gary Guo-1/+1
2022-02-12library/panic_unwind: Define UNWIND_DATA_REG for m68kJohn Paul Adrian Glaubitz-0/+3