From 188bbf840dd858edb929459bd3536219fa062077 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 28 Jul 2020 16:18:11 +0200 Subject: forbid complex types for generic parameters --- .../min_const_generics/complex-types.rs | 18 ++++++++++++ .../min_const_generics/complex-types.stderr | 34 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/test/ui/const-generics/min_const_generics/complex-types.rs create mode 100644 src/test/ui/const-generics/min_const_generics/complex-types.stderr (limited to 'src/test') diff --git a/src/test/ui/const-generics/min_const_generics/complex-types.rs b/src/test/ui/const-generics/min_const_generics/complex-types.rs new file mode 100644 index 00000000000..a396fa83aa6 --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/complex-types.rs @@ -0,0 +1,18 @@ +#![feature(min_const_generics)] + +struct Foo; +//~^ ERROR using `[u8; 0]` as const generic parameters is forbidden + +struct Bar; +//~^ ERROR using `()` as const generic parameters is forbidden + +#[derive(PartialEq, Eq)] +struct No; + +struct Fez; +//~^ ERROR using `No` as const generic parameters is forbidden + +struct Faz; +//~^ ERROR using `&'static u8` as const generic parameters is forbidden + +fn main() {} diff --git a/src/test/ui/const-generics/min_const_generics/complex-types.stderr b/src/test/ui/const-generics/min_const_generics/complex-types.stderr new file mode 100644 index 00000000000..65c7aec36d6 --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/complex-types.stderr @@ -0,0 +1,34 @@ +error: using `[u8; 0]` as const generic parameters is forbidden + --> $DIR/complex-types.rs:3:21 + | +LL | struct Foo; + | ^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: using `()` as const generic parameters is forbidden + --> $DIR/complex-types.rs:6:21 + | +LL | struct Bar; + | ^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: using `No` as const generic parameters is forbidden + --> $DIR/complex-types.rs:12:21 + | +LL | struct Fez; + | ^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/complex-types.rs:15:21 + | +LL | struct Faz; + | ^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: aborting due to 4 previous errors + -- cgit 1.4.1-3-g733a5