mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2024-11-14 21:11:31 +08:00
20 lines
697 B
Plaintext
Executable File
20 lines
697 B
Plaintext
Executable File
$ cargo run
|
|
Compiling closure-example v0.1.0 (file:///projects/closure-example)
|
|
error[E0308]: mismatched types
|
|
--> src/main.rs:5:29
|
|
|
|
|
5 | let n = example_closure(5);
|
|
| --------------- ^- help: try using a conversion method: `.to_string()`
|
|
| | |
|
|
| | expected struct `String`, found integer
|
|
| arguments to this function are incorrect
|
|
|
|
|
note: closure parameter defined here
|
|
--> src/main.rs:2:28
|
|
|
|
|
2 | let example_closure = |x| x;
|
|
| ^
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|
|
error: could not compile `closure-example` due to previous error
|