diff options
| author | b-naber <bn263@gmx.de> | 2021-11-03 15:36:38 +0100 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2021-12-05 11:35:26 +0100 |
| commit | 95209252f534ccb5bd15766234a992f53737fccf (patch) | |
| tree | 996c5ef3b1c37c74d6befb9f825dc3131b193a8d /src/test/ui/const-generics | |
| parent | 87ec5680c982e665e028cbec9219d7849a9535da (diff) | |
| download | rust-95209252f534ccb5bd15766234a992f53737fccf.tar.gz rust-95209252f534ccb5bd15766234a992f53737fccf.zip | |
add test
Diffstat (limited to 'src/test/ui/const-generics')
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-90455.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-90455.stderr | 10 |
2 files changed, 22 insertions, 0 deletions
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<const N: &'static str> { + 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 + |
