File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 11fn main ( ) {
2- let x = "hello" . chars ( ) . rev ( ) . collect ( ) ; //~ ERROR E0283
2+ let x: _ = "hello" . chars ( ) . rev ( ) . collect ( ) ; //~ ERROR E0282
33}
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
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
1812error: 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 `.
You can’t perform that action at this time.
0 commit comments