diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-07-06 12:38:26 +0000 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-07-28 16:10:41 +0200 |
| commit | f827d3e2851c97598b9d5c2648dc494ac00ca02f (patch) | |
| tree | b8e143ec231b79838d0e157fb342b26823f9b9c4 /compiler/rustc_span/src | |
| parent | eba3228b2a9875d268ff3990903d04e19f6cdb0c (diff) | |
| download | rust-f827d3e2851c97598b9d5c2648dc494ac00ca02f.tar.gz rust-f827d3e2851c97598b9d5c2648dc494ac00ca02f.zip | |
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.
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 5fc773e431c..3b17d4ca3d2 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -323,6 +323,7 @@ symbols! { await_macro, bang, begin_panic, + begin_panic_fmt, bench, bin, bind_by_move_pattern_guards, @@ -420,6 +421,7 @@ symbols! { const_loop, const_mut_refs, const_panic, + const_panic_fmt, const_precise_live_drops, const_ptr, const_raw_ptr_deref, @@ -586,6 +588,7 @@ symbols! { fmaf32, fmaf64, fmt, + fmt_as_str, fmt_internals, fmul_fast, fn_align, @@ -881,6 +884,7 @@ symbols! { panic_2021, panic_abort, panic_bounds_check, + panic_fmt, panic_handler, panic_impl, panic_implementation, |
