Closed
Description
#![feature(const_panic)]
const fn hey() -> usize {
panic!(123);
}
fn main() {
let _: [u8; hey()] = todo!();
}
Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=31e3a36a34e378389943330936b81dbf
Output
Compiling playground v0.0.1 (/playground)
error: argument to `panic!()` in a const context must have type `&str`
--> src/main.rs:4:5
|
4 | panic!(123);
| ^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
thread 'rustc' panicked at '`ref_to_mplace` called on non-ptr type', compiler/rustc_mir/src/interpret/place.rs:307:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.54.0-nightly (657bc0188 2021-05-31) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#1 [eval_to_const_value_raw] simplifying constant for the type system `main::{constant#0}`
end of query stack
error: aborting due to previous error
error: could not compile `playground`
To learn more, run the command again with --verbose.
cc @RalfJung
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.