blob: c971de0d1f2a31ffea2c9a1f0e77b0cc4b125c79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
//! Test for unconstrained type parameters in inherent implementations
struct MyType;
struct MyType1<T>(T);
trait Bar {
type Out;
}
impl<T> MyType {
//~^ ERROR the type parameter `T` is not constrained
// T is completely unused - this should fail
}
impl<T> MyType1<T> {
// OK: T is used in the self type `MyType1<T>`
}
impl<T, U> MyType1<T> {
//~^ ERROR the type parameter `U` is not constrained
// T is used in self type, but U is unconstrained - this should fail
}
impl<T, U> MyType1<T>
where
T: Bar<Out = U>,
{
// OK: T is used in self type, U is constrained through the where clause
}
fn main() {}
|