From 95209252f534ccb5bd15766234a992f53737fccf Mon Sep 17 00:00:00 2001 From: b-naber Date: Wed, 3 Nov 2021 15:36:38 +0100 Subject: [PATCH] add test --- src/test/ui/const-generics/issues/issue-90455.rs | 12 ++++++++++++ src/test/ui/const-generics/issues/issue-90455.stderr | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/const-generics/issues/issue-90455.rs create mode 100644 src/test/ui/const-generics/issues/issue-90455.stderr diff --git a/src/test/ui/const-generics/issues/issue-90455.rs b/src/test/ui/const-generics/issues/issue-90455.rs new file mode 100644 index 00000000000..a580410cf37 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90455.rs @@ -0,0 +1,12 @@ +#![feature(generic_const_exprs, adt_const_params)] +#![allow(incomplete_features)] + +struct FieldElement { + n: [u64; num_limbs(N)], + //~^ ERROR unconstrained generic constant +} +const fn num_limbs(_: &str) -> usize { + 0 +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-90455.stderr b/src/test/ui/const-generics/issues/issue-90455.stderr new file mode 100644 index 00000000000..724d7f42e69 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90455.stderr @@ -0,0 +1,10 @@ +error: unconstrained generic constant + --> $DIR/issue-90455.rs:5:8 + | +LL | n: [u64; num_limbs(N)], + | ^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); num_limbs(N)]:` + +error: aborting due to previous error +