Skip to content

Commit 0b83de8

Browse files
committed
adapted test outputs to the new behaviour: suggesting adding the
parameter to the impl struct and the struct definition if used in the impl body Signed-off-by: janwi_mac <jan.wilhelm77@gmail.com>
1 parent 1cdc8cb commit 0b83de8

14 files changed

+124
-0
lines changed

tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait,
1212
|
1313
LL | impl<'a> Foo<fn(&())> {
1414
| ^^ unconstrained lifetime parameter
15+
|
16+
help: make use of the lifetime parameter `'a` in the `self` type
17+
|
18+
LL | impl<'a> Foo<fn(&()), 'a> {
19+
| ++++
20+
help: and add it to the struct definition of Foo as well since it's used in the body of the impl
21+
|
22+
LL | struct Foo<T, 'a>(T);
23+
| ++++
1524

1625
error[E0308]: mismatched types
1726
--> $DIR/hr-do-not-blame-outlives-static-ice.rs:14:11

tests/ui/associated-types/issue-26262.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
33
|
44
LL | impl<T: Tr> S<T::Assoc> {
55
| ^ unconstrained type parameter
6+
|
7+
help: make use of the type parameter `T` in the `self` type
8+
|
9+
LL | impl<T: Tr> S<T::Assoc, T> {
10+
| +++
11+
help: and add it to the struct definition of S as well since it's used in the body of the impl
12+
|
13+
LL | struct S<T, T>(T);
14+
| +++
615

716
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
817
--> $DIR/issue-26262.rs:17:6

tests/ui/associated-types/unconstrained-lifetime-assoc-type.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait,
33
|
44
LL | impl<'a> Fun for Holder {
55
| ^^ unconstrained lifetime parameter
6+
|
7+
help: make use of the lifetime parameter `'a` in the `self` type
8+
|
9+
LL | impl<'a> Fun for Holder<'a> {
10+
| ++++
11+
help: and add it to the struct definition of Holder as well since it's used in the body of the impl
12+
|
13+
LL | struct Holder<'a> {
14+
| ++++
615

716
error: aborting due to 1 previous error
817

tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
7171
|
7272
= note: expressions using a const parameter must map each value to a distinct output value
7373
= note: proving the result of expressions other than the parameter are unique is not supported
74+
help: make use of the type parameter `N` in the `self` type
75+
|
76+
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}, N> {
77+
| +++
78+
help: and add it to the struct definition of ConstChunksExact as well since it's used in the body of the impl
79+
|
80+
LL | struct ConstChunksExact<'rem, T: 'a, const N: usize, N> {}
81+
| +++
7482

7583
error: aborting due to 8 previous errors
7684

tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<
5353
|
5454
= note: expressions using a const parameter must map each value to a distinct output value
5555
= note: proving the result of expressions other than the parameter are unique is not supported
56+
help: make use of the type parameter `N` in the `self` type
57+
|
58+
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}, N> {
59+
| +++
60+
help: and add it to the struct definition of ConstChunksExact as well since it's used in the body of the impl
61+
|
62+
LL | struct ConstChunksExact<'a, T: '_, const assert: usize, N> {}
63+
| +++
5664

5765
error[E0308]: mismatched types
5866
--> $DIR/normalizing_with_unconstrained_impl_params.rs:6:27

tests/ui/error-codes/E0207.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
33
|
44
LL | impl<T: Default> Foo {
55
| ^ unconstrained type parameter
6+
|
7+
help: make use of the type parameter `T` in the `self` type
8+
|
9+
LL | impl<T: Default> Foo<T> {
10+
| +++
11+
help: and add it to the struct definition of Foo as well since it's used in the body of the impl
12+
|
13+
LL | struct Foo<T>;
14+
| +++
615

716
error: aborting due to 1 previous error
817

tests/ui/generic-associated-types/bugs/issue-87735.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self
33
|
44
LL | impl<'b, T, U> AsRef2 for Foo<T>
55
| ^ unconstrained type parameter
6+
|
7+
help: make use of the type parameter `U` in the `self` type
8+
|
9+
LL | impl<'b, T, U> AsRef2 for Foo<T, U>
10+
| +++
11+
help: and add it to the struct definition of Foo as well since it's used in the body of the impl
12+
|
13+
LL | struct Foo<T, U>(T);
14+
| +++
615

716
error[E0309]: the parameter type `U` may not live long enough
817
--> $DIR/issue-87735.rs:34:3

tests/ui/issues/issue-22886.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait,
33
|
44
LL | impl<'a> Iterator for Newtype {
55
| ^^ unconstrained lifetime parameter
6+
|
7+
help: make use of the lifetime parameter `'a` in the `self` type
8+
|
9+
LL | impl<'a> Iterator for Newtype<'a> {
10+
| ++++
11+
help: and add it to the struct definition of Newtype as well since it's used in the body of the impl
12+
|
13+
LL | struct Newtype<'a>(Option<Box<usize>>);
14+
| ++++
615

716
error: aborting due to 1 previous error
817

tests/ui/issues/issue-35139.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait,
33
|
44
LL | impl<'a> MethodType for MTFn {
55
| ^^ unconstrained lifetime parameter
6+
|
7+
help: make use of the lifetime parameter `'a` in the `self` type
8+
|
9+
LL | impl<'a> MethodType for MTFn<'a> {
10+
| ++++
11+
help: and add it to the struct definition of MTFn as well since it's used in the body of the impl
12+
|
13+
LL | pub struct MTFn<'a>;
14+
| ++++
615

716
error: aborting due to 1 previous error
817

tests/ui/traits/unconstrained-projection-normalization-2.current.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
33
|
44
LL | impl<T: ?Sized> Every for Thing {
55
| ^ unconstrained type parameter
6+
|
7+
help: make use of the type parameter `T` in the `self` type
8+
|
9+
LL | impl<T: ?Sized> Every for Thing<T> {
10+
| +++
11+
help: and add it to the struct definition of Thing as well since it's used in the body of the impl
12+
|
13+
LL | struct Thing<T>;
14+
| +++
615

716
error[E0277]: the size for values of type `T` cannot be known at compilation time
817
--> $DIR/unconstrained-projection-normalization-2.rs:16:18

0 commit comments

Comments
 (0)