You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's this code snippet in this section which is an attempt to access an element of a vector using an invalid index.
fnmain(){let v = vec![1,2,3];
v[99];}
The explanation says, "This error points at a file we didn't write, libcore/slice/mod.rs. That's the implementation of slice in the Rust source code."
But when I run the listing in the browser and also on my local machine, the error points directly at the line where v[99]; is there, thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', src/main.rs:4:5, to be precise.
According to the community discord server, the reason for this behavior was, slice was not included in the scope in prelude at the time of writing that part in the book.
The text was updated successfully, but these errors were encountered:
There's this code snippet in this section which is an attempt to access an element of a vector using an invalid index.
The explanation says, "This error points at a file we didn't write, libcore/slice/mod.rs. That's the implementation of
slice
in the Rust source code."But when I run the listing in the browser and also on my local machine, the error points directly at the line where
v[99];
is there,thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', src/main.rs:4:5
, to be precise.According to the community discord server, the reason for this behavior was,
slice
was not included in the scope in prelude at the time of writing that part in the book.The text was updated successfully, but these errors were encountered: