]> git.lizzy.rs Git - rust.git/blob - tests/ui/defaults-well-formedness.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / defaults-well-formedness.rs
1 // run-pass
2
3 #![allow(dead_code)]
4 trait Trait<T> {}
5 struct Foo<U, V=i32>(U, V) where U: Trait<V>;
6
7 trait Marker {}
8 struct TwoParams<T, U>(T, U);
9 impl Marker for TwoParams<i32, i32> {}
10
11 // Clauses with more than 1 param are not checked.
12 struct IndividuallyBogus<T = i32, U = i32>(TwoParams<T, U>) where TwoParams<T, U>: Marker;
13 struct BogusTogether<T = u32, U = i32>(T, U) where TwoParams<T, U>: Marker;
14 // Clauses with non-defaulted params are not checked.
15 struct NonDefaultedInClause<T, U = i32>(TwoParams<T, U>) where TwoParams<T, U>: Marker;
16 struct DefaultedLhs<U, V=i32>(U, V) where V: Trait<U>;
17 // Dependent defaults are not checked.
18 struct Dependent<T, U = T>(T, U) where U: Copy;
19 trait SelfBound<T: Copy=Self> {}
20 // Not even for well-formedness.
21 struct WellFormedProjection<A, T=<A as Iterator>::Item>(A, T);
22
23 // Issue #49344, predicates with lifetimes should not be checked.
24 trait Scope<'a> {}
25 struct Request<'a, S: Scope<'a> = i32>(S, &'a ());
26
27 fn main() {}