diff --git a/tests/ui/splat/splat-generics-everywhere.rs b/tests/ui/splat/splat-generics-everywhere.rs index be4f917ce21df..90335ad31f938 100644 --- a/tests/ui/splat/splat-generics-everywhere.rs +++ b/tests/ui/splat/splat-generics-everywhere.rs @@ -3,11 +3,10 @@ #![allow(incomplete_features)] #![feature(splat)] +#![feature(tuple_trait)] struct Foo(T); -// FIXME(splat): also add assoc/method with splatted generic tuple traits -// also add generics inside the splatted tuple impl Foo { fn new(t: T) -> Self { Self(t) @@ -20,12 +19,13 @@ impl Foo { fn lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} fn const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + + fn generic_in_tuple(&self, #[splat] _s: (U, u32)) {} + + fn generic_tuple_assoc(_u: U, #[splat] _s: ()) {} } -// FIXME(splat): also add generics to the trait -// also add assoc/method with splatted generic tuple traits -// also add generics inside the splatted tuple -trait BarTrait { +trait BarTrait { fn trait_assoc(w: W, #[splat] _s: ()); fn trait_method(&self, x: X, #[splat] _s: (u32, f64)); @@ -33,9 +33,13 @@ trait BarTrait { fn trait_lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} fn trait_const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + + fn trait_generic_in_tuple(&self, #[splat] _s: (T, U)) {} + + fn trait_generic_tuple(&self, #[splat] _s: U) {} } -impl BarTrait for Foo { +impl BarTrait for Foo { fn trait_assoc(_w: W, #[splat] _s: ()) {} fn trait_method(&self, _x: X, #[splat] _s: (u32, f64)) {} @@ -43,6 +47,10 @@ impl BarTrait for Foo { fn trait_lifetime<'a>(&self, #[splat] _s: (u32, f64, &'a str)) {} fn trait_const_generic(&self, #[splat] _s: (u32, f64, [u8; N])) {} + + fn trait_generic_in_tuple(&self, #[splat] _s: (T, U)) {} + + fn trait_generic_tuple(&self, #[splat] _s: U) {} } fn main() { @@ -57,8 +65,13 @@ fn main() { foo.method("v", 1u32, 2.3); foo.lifetime(1u32, 2.3, "asdf"); foo.const_generic(1u32, 2.3, [1, 2, 3]); + foo.generic_in_tuple(42i32, 1u32); + Foo::::generic_tuple_assoc(()); + Foo::::trait_assoc("w"); foo.trait_method("x", 42u32, 9.8); foo.trait_lifetime(1u32, 2.3, "asdf"); foo.trait_const_generic(1u32, 2.3, [1, 2, 3]); + foo.trait_generic_in_tuple("hello", 42i32); + foo.trait_generic_tuple(); }