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