rust-book-cn/listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt

36 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2021-05-09 14:49:31 +08:00
$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
2022-02-02 16:24:47 +08:00
error: expected expression, found statement (`let`)
2021-05-09 14:49:31 +08:00
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
2022-02-02 16:24:47 +08:00
= note: variable declaration using `let` is a statement
2021-05-09 14:49:31 +08:00
2022-02-02 16:24:47 +08:00
error[E0658]: `let` expressions in this position are experimental
2021-05-09 14:49:31 +08:00
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
2022-02-02 16:24:47 +08:00
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: you can write `matches!(<expr>, <pattern>)` instead of `let <pattern> = <expr>`
2021-05-09 14:49:31 +08:00
warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
|
2 | let x = (let y = 6);
2022-02-02 16:24:47 +08:00
| ^ ^
2021-05-09 14:49:31 +08:00
|
= note: `#[warn(unused_parens)]` on by default
2022-02-02 16:24:47 +08:00
help: remove these parentheses
|
2 - let x = (let y = 6);
2 + let x = let y = 6;
|
2021-05-09 14:49:31 +08:00
For more information about this error, try `rustc --explain E0658`.
2022-01-18 23:33:06 +08:00
warning: `functions` (bin "functions") generated 1 warning
error: could not compile `functions` due to 2 previous errors; 1 warning emitted