Closed
Description
#![feature(const_fn)]
const fn foo(x: usize) -> usize {
return x;
}
fn main() {
[0; foo(2)];
}
or
#![feature(const_fn)]
const unsafe fn foo(x: usize) -> usize {
return x;
}
fn main() {
[0; unsafe {foo(2)}];
}
Note: rustc 1.21.0-nightly (cbbe17a 2017-08-07) running on x86_64-apple-darwin
Run: Cargo build
ICEs with:
Compiling hello v0.1.0 (file:///.../hello)
error: internal compiler error: src/librustc_mir/hair/cx/expr.rs:472: constant evaluation of repeat count yielded Tuple([])
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.21.0-nightly (cbbe17aa7 2017-08-07) running on x86_64-apple-darwin
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:486:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.