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
An explanation of the panic seems outdated.
The book refers to an error in a source file in core (here slice/mod.rs) but the error message instead refers to the caller (which is the indexing operation) in main.
The panic :
$ cargo run
Compiling panic v0.1.0 (file:///projects/panic)
Finished dev [unoptimized + debuginfo] target(s) in 0.27s
Running `target/debug/panic`
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', src/main.rs:4:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The explanation:
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. The code that gets run when we use [] on our vector v is in libcore/slice/mod.rs, and that is where the panic! is actually happening.
I assume this is due to the introduction of #[track_caller].
The text was updated successfully, but these errors were encountered:
In chapter 09-1, available here:
https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html
An explanation of the panic seems outdated.
The book refers to an error in a source file in core (here
slice/mod.rs
) but the error message instead refers to the caller (which is the indexing operation) in main.The panic :
The explanation:
I assume this is due to the introduction of #[track_caller].
The text was updated successfully, but these errors were encountered: