Skip to content

Commit 6d2a2c4

Browse files
committed
Remove distraction about literal 100
1 parent da9422b commit 6d2a2c4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/ch09-01-unrecoverable-errors-with-panic.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ fn main() {
6060
We attempt to access the hundredth element of our vector, but it only has three
6161
elements. In this situation, Rust will panic. Using `[]` is supposed to return
6262
an element. If you pass `[]` an invalid index, though, there's no element that
63-
Rust could return here that would be correct. In this case, we've typed in a
64-
literal index of `100`, so in theory, Rust could examine our code at compile
65-
time and raise an error at that point. But if our program was different, say,
66-
maybe reading the index from user input, it would not be possible to determine
67-
at compile time if the index was in bounds.
63+
Rust could return here that would be correct.
6864
6965
Other languages like C will attempt to give you exactly what you asked for in
7066
this situation, even though it isn't what you want: you'll get whatever is at

0 commit comments

Comments
 (0)