Skip to content

Commit

Permalink
Fixes hardcoded output
Browse files Browse the repository at this point in the history
Resolves #2275
  • Loading branch information
NejcZdovc committed Feb 24, 2020
1 parent 6fb3705 commit c38877a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
@@ -0,0 +1,9 @@
$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
error: expected expression, found statement (`let`)
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^
|
= note: variable declaration using `let` is a statement
15 changes: 1 addition & 14 deletions src/ch03-03-how-functions-work.md
Expand Up @@ -137,20 +137,7 @@ to another variable, as the following code tries to do; you’ll get an error:

When you run this program, the error you’ll get looks like this:

<!--TODO: not extracting this because the new error message is incorrect; see
https://github.com/rust-lang/rust/issues/65254 -->

```text
$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
error: expected expression, found statement (`let`)
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^
|
= note: variable declaration using `let` is a statement
```
{{#include ../listings/ch03-common-programming-concepts/no-listing-19-statements-vs-expressions/output.txt}}

The `let y = 6` statement does not return a value, so there isn’t anything for
`x` to bind to. This is different from what happens in other languages, such as
Expand Down

0 comments on commit c38877a

Please sign in to comment.