diff --git a/src/test/ui/const-generics/dyn-supertraits.rs b/src/test/ui/const-generics/dyn-supertraits.rs new file mode 100644 index 00000000000..b72dd9cc90c --- /dev/null +++ b/src/test/ui/const-generics/dyn-supertraits.rs @@ -0,0 +1,58 @@ +// 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 Foo {} +trait Bar : Foo {} +trait Baz: Foo<3> {} + +struct FooType {} +struct BarType {} +struct BazType {} + +impl Foo for FooType {} +impl Foo for BarType {} +impl Bar for BarType {} +impl Foo<3> for BazType {} +impl Baz for BazType {} + +trait Foz {} +trait Boz: Foo<3> + Foz {} +trait Bok: Foo + Foz {} + +struct FozType {} +struct BozType {} +struct BokType {} + +impl Foz for FozType {} + +impl Foz for BozType {} +impl Foo<3> for BozType {} +impl Boz for BozType {} + +impl Foz for BokType {} +impl Foo for BokType {} +impl Bok for BokType {} + +fn a(x: &dyn Foo) {} +fn b(x: &dyn Foo<3>) {} + +fn main() { + let foo = FooType::<3> {}; + a(&foo); b(&foo); + + let bar = BarType::<3> {}; + a(&bar); b(&bar); + + let baz = BazType {}; + a(&baz); b(&baz); + + let boz = BozType {}; + a(&boz); b(&boz); + + let bok = BokType::<3> {}; + a(&bok); b(&bok); +}