Fix ICE and report a human readable error
This commit is contained in:
parent
8f19cadf95
commit
507381ed03
4 changed files with 27 additions and 3 deletions
5
src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs
Normal file
5
src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs
Normal 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() {}
|
||||
10
src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
Normal file
10
src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue