From 4b5cd0413095b3ccca2d0c799eeb62d418d42248 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 10 Nov 2020 10:38:36 +0100 Subject: add test for where clauses mentioning const params --- src/test/ui/const-generics/where-clauses.rs | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/ui/const-generics/where-clauses.rs diff --git a/src/test/ui/const-generics/where-clauses.rs b/src/test/ui/const-generics/where-clauses.rs new file mode 100644 index 00000000000..cdcaf250942 --- /dev/null +++ b/src/test/ui/const-generics/where-clauses.rs @@ -0,0 +1,35 @@ +// check-pass +// revisions: full min +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] + +trait Bar { fn bar() {} } +trait Foo: Bar {} + +fn test() where T: Foo { + >::bar(); +} + +struct Faz; + +impl Faz { + fn test() where T: Foo { + >::bar() + } +} + +trait Fiz { + fn fiz() where T: Foo { + >::bar(); + } +} + +impl Bar for u8 {} +impl Foo for u8 {} +impl Fiz for u8 {} +fn main() { + test::(); + Faz::<3>::test::(); + >::fiz::(); +} -- cgit 1.4.1-3-g733a5