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`
This commit is contained in:
commit
6e0a8bf790
17 changed files with 203 additions and 21 deletions
|
@ -247,6 +247,7 @@
|
|||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn_transmute))]
|
||||
#![feature(const_format_args)]
|
||||
#![feature(const_io_structs)]
|
||||
#![feature(const_ip)]
|
||||
#![feature(const_ipv4)]
|
||||
|
@ -555,9 +556,9 @@ pub use core::{
|
|||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[allow(deprecated)]
|
||||
pub use core::{
|
||||
assert, assert_matches, cfg, column, compile_error, concat, concat_idents, env, file,
|
||||
format_args, format_args_nl, include, include_bytes, include_str, line, llvm_asm, log_syntax,
|
||||
module_path, option_env, stringify, trace_macros,
|
||||
assert, assert_matches, cfg, column, compile_error, concat, concat_idents, const_format_args,
|
||||
env, file, format_args, format_args_nl, include, include_bytes, include_str, line, llvm_asm,
|
||||
log_syntax, module_path, option_env, stringify, trace_macros,
|
||||
};
|
||||
|
||||
#[stable(feature = "core_primitive", since = "1.43.0")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue