From b3207d531d01c1dc6c1f3d4e7b1c20a1546fe108 Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 11 May 2019 00:08:40 +0100 Subject: [PATCH] Add test for const impl --- .../const-generics/impl-const-generic-struct.rs | 16 ++++++++++++++++ .../impl-const-generic-struct.stderr | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/const-generics/impl-const-generic-struct.rs create mode 100644 src/test/ui/const-generics/impl-const-generic-struct.stderr diff --git a/src/test/ui/const-generics/impl-const-generic-struct.rs b/src/test/ui/const-generics/impl-const-generic-struct.rs new file mode 100644 index 00000000000..7a0c0f2be5d --- /dev/null +++ b/src/test/ui/const-generics/impl-const-generic-struct.rs @@ -0,0 +1,16 @@ +// run-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +struct S; + +impl S<{X}> { + fn x() -> u32 { + X + } +} + +fn main() { + assert_eq!(S::<19>::x(), 19); +} diff --git a/src/test/ui/const-generics/impl-const-generic-struct.stderr b/src/test/ui/const-generics/impl-const-generic-struct.stderr new file mode 100644 index 00000000000..d443e060a97 --- /dev/null +++ b/src/test/ui/const-generics/impl-const-generic-struct.stderr @@ -0,0 +1,6 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/impl-const-generic-struct.rs:3:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + -- 2.44.0