diff --git a/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.rs b/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.rs new file mode 100644 index 0000000000000..bb7597afaa47c --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.rs @@ -0,0 +1,11 @@ +//@ edition: 2018 +// regression test for #119316 +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +async fn foo<'a>() { + let _data = &mut [0u8; { N + (|| 42)() }]; + //~^ ERROR cannot find value `N` in this scope +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.stderr b/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.stderr new file mode 100644 index 0000000000000..a98f9a29b0707 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/closure-in-array-len-ice-119316.stderr @@ -0,0 +1,14 @@ +error[E0425]: cannot find value `N` in this scope + --> $DIR/closure-in-array-len-ice-119316.rs:7:30 + | +LL | let _data = &mut [0u8; { N + (|| 42)() }]; + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | async fn foo<'a, const N: /* Type */>() { + | +++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`.