-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the error message of invalid array element access in ch03.2
- Loading branch information
Showing
2 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
18 changes: 13 additions & 5 deletions
18
listings/ch03-common-programming-concepts/no-listing-15-invalid-array-access/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
$ cargo run | ||
Compiling arrays v0.1.0 (file:///projects/arrays) | ||
Finished dev [unoptimized + debuginfo] target(s) in 0.31s | ||
Running `target/debug/arrays` | ||
thread 'main' panicked at 'index out of bounds: the len is 5 but the index is 10', src/main.rs:5:19 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. | ||
error: this operation will panic at runtime | ||
--> src/main.rs:5:19 | ||
| | ||
5 | let element = a[index]; | ||
| ^^^^^^^^ index out of bounds: the len is 5 but the index is 10 | ||
| | ||
= note: `#[deny(unconditional_panic)]` on by default | ||
|
||
error: aborting due to previous error | ||
|
||
error: could not compile `arrays`. | ||
|
||
To learn more, run the command again with --verbose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters