Skip to content

Commit e940189

Browse files
author
taku-a11y
authored
Merge pull request #1 from taku-a11y/patch-2
Update ch03-03-how-functions-work.md
2 parents 7087112 + 94abc2c commit e940189

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/ch03-03-how-functions-work.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,20 +586,26 @@ Running this code produces an error, as follows:
586586
このコードを実行すると、以下のようにエラーが出ます:
587587

588588
```text
589+
$ cargo run
590+
Compiling functions v0.1.0 (file:///projects/functions)
589591
error[E0308]: mismatched types
590592
(型が合いません)
591-
--> src/main.rs:7:28
592-
|
593-
7 | fn plus_one(x: i32) -> i32 {
594-
| ____________________________^
595-
8 | | x + 1;
596-
| | - help: consider removing this semicolon
597-
9 | | }
598-
| |_^ expected i32, found ()
599-
| (i32を予期したのに、()型が見つかりました)
593+
594+
--> src/main.rs:7:24
600595
|
601-
= note: expected type `i32`
602-
found type `()`
596+
7 | fn plus_one(x: i32) -> i32 {
597+
| -------- ^^^ expected `i32`, found `()`
598+
| |
599+
| implicitly returns `()` as its body has no tail or `return` expression
600+
8 | x + 1;
601+
| - help: consider removing this semicolon
602+
603+
error: aborting due to previous error
604+
605+
For more information about this error, try `rustc --explain E0308`.
606+
error: could not compile `functions`
607+
608+
To learn more, run the command again with --verbose.
603609
```
604610

605611
<!--

0 commit comments

Comments
 (0)