Skip to content

Commit cdaf91f

Browse files
committed
moved renamed docs stderr formatted | impl-unused-tps-inherent.rs
1 parent 5abb087 commit cdaf91f

File tree

3 files changed

+36
-29
lines changed

3 files changed

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

tests/ui/impl-unused-tps-inherent.stderr renamed to tests/ui/generics/unconstrained-type-params-inherent-impl.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
2-
--> $DIR/impl-unused-tps-inherent.rs:9:6
2+
--> $DIR/unconstrained-type-params-inherent-impl.rs:11:6
33
|
44
LL | impl<T> MyType {
55
| ^ unconstrained type parameter
66

77
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
8-
--> $DIR/impl-unused-tps-inherent.rs:17:8
8+
--> $DIR/unconstrained-type-params-inherent-impl.rs:20:9
99
|
10-
LL | impl<T,U> MyType1<T> {
11-
| ^ unconstrained type parameter
10+
LL | impl<T, U> MyType1<T> {
11+
| ^ unconstrained type parameter
1212

1313
error: aborting due to 2 previous errors
1414

tests/ui/impl-unused-tps-inherent.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)