Poor recovery from [_]::method · Issue #89388 · rust-lang/rust (original) (raw)
error: expected one of )
, ,
, .
, ?
, or an operator, found ::
--> src/main.rs:3:27
|
3 | let _ = option.map([_]::to_vec);
| -^
| |
| expected one of )
, ,
, .
, ?
, or an operator
| help: missing ,
error[E0425]: cannot find crate to_vec
in the list of imported crates
--> src/main.rs:3:29
|
3 | let _ = option.map([_]::to_vec);
| ^^^^^^ not found in the list of imported crates
error: in expressions, _
can only be used on the left-hand side of an assignment
--> src/main.rs:3:25
|
3 | let _ = option.map([_]::to_vec);
| ^ _
not allowed here
error[E0061]: this function takes 1 argument but 2 arguments were supplied --> src/main.rs:3:20 | 3 | let _ = option.map([_]::to_vec); | ^^^ ----------- supplied 2 arguments | | | expected 1 argument | note: associated function defined here --> /media/david/coding/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:843:12 | 843 | pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option { | ^^^
Some errors have detailed explanations: E0061, E0425.
For more information about an error, try rustc --explain E0061
.
error: missing angle brackets in associated item path
--> src/main.rs:3:24
|
3 | let _ = option.map([_]::to_vec);
| ^^^^^^^^^^^ help: try: <[_]>::to_vec
Indeed this is exactly that you already get if you had put [u8]::to_vec
instead of [_]::to_vec
.
error: missing angle brackets in associated item path
--> src/main.rs:3:24
|
3 | let _ = option.map([u8]::to_vec);
| ^^^^^^^^^^^^ help: try: <[u8]>::to_vec