mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
ec84633b54
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) |
||
---|---|---|
.. | ||
benches | ||
primitive_docs | ||
src | ||
tests | ||
Cargo.toml |