From fcc88fab6c1b71a81386046135069203dc553f69 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Sun, 27 Dec 2020 19:28:09 +0100 Subject: [PATCH] Add regression test for #80375 --- src/test/ui/const-generics/issues/issue-80375.rs | 4 ++++ src/test/ui/const-generics/issues/issue-80375.stderr | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/ui/const-generics/issues/issue-80375.rs create mode 100644 src/test/ui/const-generics/issues/issue-80375.stderr diff --git a/src/test/ui/const-generics/issues/issue-80375.rs b/src/test/ui/const-generics/issues/issue-80375.rs new file mode 100644 index 00000000000..c906bb2c4d9 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-80375.rs @@ -0,0 +1,4 @@ +struct MyArray([u8; COUNT + 1]); +//~^ ERROR generic parameters may not be used in const operations + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-80375.stderr b/src/test/ui/const-generics/issues/issue-80375.stderr new file mode 100644 index 00000000000..9765a639a48 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-80375.stderr @@ -0,0 +1,11 @@ +error: generic parameters may not be used in const operations + --> $DIR/issue-80375.rs:1:41 + | +LL | struct MyArray([u8; COUNT + 1]); + | ^^^^^ cannot perform const operation using `COUNT` + | + = help: const parameters may only be used as standalone arguments, i.e. `COUNT` + = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions + +error: aborting due to previous error +