Comment Comment by OptionOfT On the footnote:> [1] Other languages - like Go or Python - have a runtime check that raises some sort of exception or panic when lst[0] is accessed on an empty list or slice.Rust has the same thing. Accessing a `Vec` by index goes via the index trait: https://doc.rust-lang.org/std/ops/trait.Index.html#tymethod....Vec implements Index here: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...Vec's Index defers to slice's: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...Slice defers to... intrinsics: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...Which injects a bounds check: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...The bounds check: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...So I'd say the footnote is not correct. parent OptionOfT 1 month ago
> [1] Other languages - like Go or Python - have a runtime check that raises some sort of exception or panic when lst[0] is accessed on an empty list or slice.
Rust has the same thing. Accessing a `Vec` by index goes via the index trait: https://doc.rust-lang.org/std/ops/trait.Index.html#tymethod....
Vec implements Index here: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...
Vec's Index defers to slice's: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...
Slice defers to... intrinsics: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...
Which injects a bounds check: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...
The bounds check: https://github.com/rust-lang/rust/blob/d080e7dff1b0fc5454154...
So I'd say the footnote is not correct.