File tree 2 files changed +9
-15
lines changed
2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- let x = "hello" . chars ( ) . rev ( ) . collect ( ) ; //~ ERROR E0283
2
+ let x: _ = "hello" . chars ( ) . rev ( ) . collect ( ) ; //~ ERROR E0282
3
3
}
Original file line number Diff line number Diff line change 1
- error[E0283 ]: type annotations needed
2
- --> $DIR/E0282.rs:2:9
1
+ error[E0282 ]: type annotations needed
2
+ --> $DIR/E0282.rs:2:38
3
3
|
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`
6
6
|
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
10
8
|
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
+ | +++++
17
11
18
12
error: aborting due to previous error
19
13
20
- For more information about this error, try `rustc --explain E0283 `.
14
+ For more information about this error, try `rustc --explain E0282 `.
You can’t perform that action at this time.
0 commit comments