Skip to content

Commit 4c8ffb7

Browse files
Make E0282 actually E0282
1 parent b6124ed commit 4c8ffb7

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/test/ui/error-codes/E0282.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fn main() {
2-
let x = "hello".chars().rev().collect(); //~ ERROR E0283
2+
let x: _ = "hello".chars().rev().collect(); //~ ERROR E0282
33
}

src/test/ui/error-codes/E0282.stderr

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
error[E0283]: type annotations needed
2-
--> $DIR/E0282.rs:2:9
1+
error[E0282]: type annotations needed
2+
--> $DIR/E0282.rs:2:38
33
|
4-
LL | let x = "hello".chars().rev().collect();
5-
| ^ ------- type must be known at this point
4+
LL | let x: _ = "hello".chars().rev().collect();
5+
| ^^^^^^^ cannot infer type of the type parameter `B` declared on the associated function `collect`
66
|
7-
= note: cannot satisfy `_: FromIterator<char>`
8-
note: required by a bound in `collect`
9-
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
7+
help: consider specifying the generic argument
108
|
11-
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
12-
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
13-
help: consider specifying the type argument in the function call
14-
|
15-
LL | let x = "hello".chars().rev().collect::<B>();
16-
| +++++
9+
LL | let x: _ = "hello".chars().rev().collect::<B>();
10+
| +++++
1711

1812
error: aborting due to previous error
1913

20-
For more information about this error, try `rustc --explain E0283`.
14+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)