Commit graph

83 commits

Author SHA1 Message Date
bors 5ced3dad57 Auto merge of #125853 - tesuji:promote-fail-fast, r=cjgillot
promote_consts: some clean-up after experimenting

This is some clean-up after experimenting in #125916,
Prefer to review commit-by-commit.
2024-06-21 16:00:14 +00:00
bors 1ca578e68e Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr
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-20 13:36:42 +00:00
Nicholas Nethercote 665821cb60 Add blank lines after module-level //! comments.
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-20 09:23:20 +10:00
Gary Guo ebdfcd93a3 Stabilise c_unwind 2024-06-19 13:54:51 +01:00
Lzu Tao 06aee7ee03 use rustc-dep-of-std in panic_unwind
Wihout it, std keeps rebuiling when unchanged.
But we could use `--keep-stage=1` to make it not rebuild.
2024-06-16 09:38:30 +00:00
Chris Denton b1f1039d8b
Replace libc::c_int with core::ffi::c_int
And remove the libc crate when it isn't needed
2024-04-14 07:11:51 +00:00
niluxv f63d5d1dcd
Refactor panic_unwind/seh.rs pointer use; x86 now conforms to strict-provenance 2024-04-11 20:47:52 +02:00
Mara Bos 5e4cc6f694 SeqCst->Relaxed in panic_unwind/emcc.
SeqCst is unnecessary here.
2024-03-19 15:27:11 +01:00
Jubilee 1279830068
Rollup merge of #121438 - coolreader18:wasm32-panic-unwind, r=cuviper
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-03-11 09:29:34 -07:00
Ralf Jung a3c0f3af9c miri: rename miri_start_panic → miri_start_unwind 2024-02-26 11:10:18 +01:00
Pavel Grigorenko 58c8c0853f
Get rid of some #[allow(static_mut_refs)] 2024-02-23 18:02:25 +03:00
Noa 125b26acf6
Use Itanium ABI for thrown exceptions 2024-02-22 17:39:49 -06:00
Noa 658a0a20ea
Unconditionally pass -wasm-enable-eh 2024-02-22 16:52:48 -06:00
Noa 3908a935ef
std support for wasm32 panic=unwind 2024-02-22 16:45:26 -06:00
Obei Sideg 408eeae59d Improve wording of static_mut_ref
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-18 06:01:40 +03:00
Mark Rousskov 9a5034a20e Step all bootstrap cfgs forward
This also takes care of other bootstrap-related changes.
2024-02-08 07:44:34 -05:00
Obei Sideg a8aa6878f6 Update test for E0796 and static_mut_ref lint 2024-01-07 17:29:25 +03:00
Sean Cross 28203172de panic_unwind: support unwinding on xous
Now that `unwind` supports Xous, enable unwinding panics on Xous.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-11-16 15:23:09 +08:00
niluxv e7a3c341dd
Use pointers instead of usize addresses for landing pads
This bring unwind and personality code more in line with strict-provenance
2023-10-10 09:59:39 +02:00
Mara Bos 76d9b3689c Rename BoxMeUp to PanicPayload. 2023-09-20 19:24:52 +02:00
Mark Rousskov 0a916062aa Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
Benedikt Radtke 3f3262e592 stabilize abi_thiscall 2023-08-07 14:11:03 +02:00
Nilstrieb 5830ca216d Add internal_features lint
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-08-03 14:50:50 +02:00
Gary Guo 723aee2e56 Partial stabilisation of c_unwind 2023-04-29 13:01:44 +01:00
bjorn3 b874502a20 Remove unnecessary raw pointer in __rust_start_panic arg
It is no longer necessary as __rust_start_panic switched to the Rust abi.
2023-03-26 16:40:18 +00:00
jonathanCogan 72067c77bd Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
Matthias Krüger 747f29fbab
Rollup merge of #103989 - arlosi:arm32-panic, r=Amanieu
Fix build of std for thumbv7a-pc-windows-msvc

Attempting to build std for the tier-3 target `thumbv7a-pc-windows-msvc` fails with the following error:
```
Building stage1 std artifacts (x86_64-pc-windows-msvc -> thumbv7a-pc-windows-msvc)
..
LLVM ERROR: WinEH not implemented for this target
error: could not compile `panic_unwind`
```

EH (unwinding) is not supported by LLVM for 32 bit arm msvc targets. This changes panic unwind to use the dummy implementation for `thumbv7a-pc-windows-msvc`.
2022-11-19 15:35:20 +01:00
Arlo Siemsen 7c60236036 Fix build of thumbv7a-pc-windows-msvc 2022-11-04 14:35:56 -07:00
Collin Baker dfab01b6e0 Remove std's transitive dependency on cfg-if 0.1
After rust-lang/rust#101946 this completes the move to cfg-if 1.0 by:
* Updating getrandom 0.1.14->0.1.16
* Updating panic_abort, panic_unwind, and unwind to cfg-if 1.0
2022-11-02 18:01:20 -04:00
Gary Guo 4e6d60c837 Fix alloc size 2022-10-23 20:30:16 +01:00
Gary Guo 979d1a2c78 Apply suggestion
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2022-10-23 20:30:16 +01:00
Gary Guo 86c65d2c1c Implement Rust foreign exception protection for EMCC and SEH 2022-10-23 20:30:16 +01:00
Gary Guo e521a8d46b Prevent foreign Rust exceptions from being caught 2022-10-23 20:30:16 +01:00
bors 91f128baf7 Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrum
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-28 04:16:29 +00:00
Tomasz Miąsko f5db0c7110 Use renamed atomic intrinsics in panic_unwind 2022-08-23 16:24:59 +02:00
Amanieu d'Antras c110329f25 Remove custom frame info registration on i686-pc-windows-gnu
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-23 16:12:58 +08:00
Amanieu d'Antras 5ff0876694 Move 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.
2022-08-23 16:12:58 +08:00
Amanieu d'Antras db94dbc597 Fix comment on the SEH personality function 2022-08-23 11:14:40 +08:00
Maybe Waffle e4720e1cf2 Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
Mads Marquart 15b7a08747 Fix unwinding when debug assertions are enabled
This came up on armv7-apple-ios when using -Zbuild-std
2022-07-30 05:14:54 +02:00
Vladimir Michael Eatwell 439d64a83c Library changes for Apple WatchOS 2022-07-20 08:57:36 +01:00
Hood Chatham d2d205d0a8 Add underscores to rust_eh_personality arguments to mark them as unused 2022-06-09 09:50:26 -07:00
Hood Chatham 46a3f0feb6 Remove __gxx_personality_v0 declaration 2022-06-08 16:31:21 -07:00
Hood Chatham 0ec3174e3e Fix formatter 2022-06-08 10:25:18 -07:00
Hood Chatham 2ecbdc1b32 Don't use __gxx_personality_v0 in panic_unwind on emscripten target
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-08 10:04:02 -07:00
Jack Huey 410dcc9674 Fully stabilize NLL 2022-06-03 17:16:41 -04:00
Gary Guo 68f063bf3f Use Rust ABI for __rust_start_panic and _{rdl,rg}_oom 2022-05-14 02:53:59 +01:00
John Paul Adrian Glaubitz 990326fa74 library/panic_unwind: Define UNWIND_DATA_REG for m68k 2022-02-12 20:19:06 +00:00
Benjamin Lamowski 660d993c64 adapt L4Bender implementation
- Fix style errors.

- L4-bender does not yet support dynamic linking.

- Stack unwinding is not yet supported for x86_64-unknown-l4re-uclibc.
  For now, just abort on panics.

- Use GNU-style linker options where possible. As suggested by review:
    - Use standard GNU-style ld syntax for relro flags.
    - Use standard GNU-style optimization flags and logic.
    - Use standard GNU-style ld syntax for --subsystem.

- Don't read environment variables in L4Bender linker. Thanks to
  CARGO_ENCODED_RUSTFLAGS introduced in #9601, l4-bender's arguments can
  now be passed from the L4Re build system without resorting to custom
  parsing of environment variables.
2022-01-21 16:50:33 +01:00
Deadbeef 06a1c14d52
Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00