Fix ICE and report a human readable error

This commit is contained in:
Oliver Scherer 2018-10-13 23:38:31 +02:00
parent 8f19cadf95
commit 507381ed03
4 changed files with 27 additions and 3 deletions

View file

@ -0,0 +1,5 @@
const fn foo(a: i32) -> Vec<i32> {
vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn
}
fn main() {}

View file

@ -0,0 +1,10 @@
error: heap allocations are not allowed in const fn
--> $DIR/bad_const_fn_body_ice.rs:2:5
|
LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn
| ^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error