diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-17 15:58:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-17 15:58:00 +0100 |
| commit | ec84633b542a7c14e380c8fb77f20a84b12cb2fe (patch) | |
| tree | ef9a1bb8fee3ce053e1bd5a0cdcf7af983c0b8f2 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | d7b86880d24ab7a7be60e6c3167142111c4d1970 (diff) | |
| parent | 6d2f8af1db238e0a2af73470be950bee65a692e6 (diff) | |
| download | rust-ec84633b542a7c14e380c8fb77f20a84b12cb2fe.tar.gz rust-ec84633b542a7c14e380c8fb77f20a84b12cb2fe.zip | |
Rollup merge of #90687 - jhpratt:const_panic, r=oli-obk
Permit const panics in stable const contexts in stdlib
Without this change, it is not possible to use `panic!` and similar (including `assert!`) in stable const contexts inside of stdlib. See #89542 for a real-world case that currently fails for this reason. This does _not_ affect any user code.
For example, this snippet currently fails to compile:
```rust
#[stable(feature = "foo", since = "1.0.0")]
#[rustc_const_stable(feature = "foo", since = "1.0.0")]
const fn foo() {
assert!(false);
assert!(false, "foo");
}
```
With the addition of `#[rustc_const_unstable]` to `core::panicking::panic`, the error no longer occurs. This snippet has been added verbatim in this PR as a UI test.
To avoid needing to add `#![feature(core_panic)]` to libcore, the two instances of direct calls to `core::panicking::panic` have been switched to use the `panic!` macro.
I am requesting prioritization because this is holding up other stabilizations such as #89542 (which is otherwise ready to merge and succeeds with this change)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
