Add tests for dependent defaults.
This commit is contained in:
parent
75997d85c5
commit
81ab26c99a
@ -19,5 +19,7 @@ struct IndividuallyBogus<T = i32, U = i32>(TwoParams<T, U>) where TwoParams<T, U
|
||||
// Clauses with non-defaulted params are not checked.
|
||||
struct NonDefaultedInClause<T, U = i32>(TwoParams<T, U>) where TwoParams<T, U>: Marker;
|
||||
struct DefaultedLhs<U, V=i32>(U, V) where V: Trait<U>;
|
||||
// Dependent defaults.
|
||||
struct Dependent<T: Copy, U = T>(T, U) where U: Copy;
|
||||
|
||||
fn main() {}
|
||||
|
@ -47,4 +47,8 @@ trait Bar<V> {}
|
||||
impl Bar<String> for u32 { }
|
||||
impl Bar<i32> for String { }
|
||||
|
||||
// Dependent defaults.
|
||||
struct Dependent<T, U = T>(T, U) where U: Copy;
|
||||
//~^ the trait bound `T: std::marker::Copy` is not satisfied [E0277]
|
||||
|
||||
fn main() { }
|
||||
|
@ -102,5 +102,14 @@ note: required by `Bar`
|
||||
46 | trait Bar<V> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
|
||||
--> $DIR/type-check-defaults.rs:51:1
|
||||
|
|
||||
51 | struct Dependent<T, U = T>(T, U) where U: Copy;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
||||
|
|
||||
= help: consider adding a `where T: std::marker::Copy` bound
|
||||
= note: required by `std::marker::Copy`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user