]> git.lizzy.rs Git - rust.git/commit
Auto merge of #86998 - m-ou-se:const-panic-fmt-as-str, r=oli-obk
authorbors <bors@rust-lang.org>
Thu, 29 Jul 2021 07:12:07 +0000 (07:12 +0000)
committerbors <bors@rust-lang.org>
Thu, 29 Jul 2021 07:12:07 +0000 (07:12 +0000)
commit6e0a8bf7901a3fe2e073b1e702e80f58b76d5087
treebd9b79e97e2d2204a5a1c2e22b9459811cc59809
parent581b1664c92f78f3d15181c78a16480987256ecb
parent312bf8e0b8122fd681adf28f65e88f8d15f7a34c
Auto merge of #86998 - m-ou-se:const-panic-fmt-as-str, r=oli-obk

Make const panic!("..") work in Rust 2021.

During const eval, this replaces calls to core::panicking::panic_fmt and std::panicking::being_panic_fmt with a call to a new const fn: core::panicking::const_panic_fmt. That function uses fmt::Arguments::as_str() to get the str and calls panic_str with that instead.

panic!() invocations with formatting arguments are still not accepted, as the creation of such a fmt::Arguments cannot be done in constant functions right now.

r? `@RalfJung`
library/core/src/lib.rs
library/std/src/lib.rs