about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-09-17 17:41:19 +0200
committerGitHub <noreply@github.com>2021-09-17 17:41:19 +0200
commiteb62779f2d6dc5cfe9208416e13392744b4e76ac (patch)
tree5886a363f22f0a69a8f58f55933c56eb6ed637e3 /compiler/rustc_span/src
parent723d27934bcf7b8ded74c8a90298fdaece99ebd2 (diff)
parent11c0e58c7489df3f71c3aebe04ad6d1b6a9f6262 (diff)
downloadrust-eb62779f2d6dc5cfe9208416e13392744b4e76ac.tar.gz
rust-eb62779f2d6dc5cfe9208416e13392744b4e76ac.zip
Rollup merge of #88954 - nbdd0121:panic3, r=oli-obk
Allow `panic!("{}", computed_str)` in const fn.

Special-case `panic!("{}", arg)` and translate it to `panic_display(&arg)`. `panic_display` will behave like `panic_any` in cosnt eval and behave like `panic!(format_args!("{}", arg))` in runtime.

This should bring Rust 2015 and 2021 to feature parity in terms of `const_panic`; and hopefully would unblock the stabilisation of #51999.

`@rustbot` modify labels: +T-compiler +T-libs +A-const-eval +A-const-fn

r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/symbol.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 760357644a5..2dff03a9c55 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -923,6 +923,7 @@ symbols! {
         panic_2021,
         panic_abort,
         panic_bounds_check,
+        panic_display,
         panic_fmt,
         panic_handler,
         panic_impl,