mirror of
https://github.com/rust-lang/book.git
synced 2026-12-04 13:24:55 -06:00
Update and extract backtrace
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
Please replace the text of Listing 9-2 on page 152-153 with this text:
|
||||
|
||||
```
|
||||
$ RUST_BACKTRACE=1 cargo run
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
|
||||
Running `target/debug/panic`
|
||||
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', libcore/slice/mod.rs:2448:10
|
||||
stack backtrace:
|
||||
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
|
||||
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
|
||||
1: std::sys_common::backtrace::print
|
||||
at libstd/sys_common/backtrace.rs:71
|
||||
at libstd/sys_common/backtrace.rs:59
|
||||
2: std::panicking::default_hook::{{closure}}
|
||||
at libstd/panicking.rs:211
|
||||
3: std::panicking::default_hook
|
||||
at libstd/panicking.rs:227
|
||||
4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
|
||||
at libstd/panicking.rs:476
|
||||
5: std::panicking::continue_panic_fmt
|
||||
at libstd/panicking.rs:390
|
||||
6: std::panicking::try::do_call
|
||||
at libstd/panicking.rs:325
|
||||
7: core::ptr::drop_in_place
|
||||
at libcore/panicking.rs:77
|
||||
8: core::ptr::drop_in_place
|
||||
at libcore/panicking.rs:59
|
||||
9: <usize as core::slice::SliceIndex<[T]>>::index
|
||||
at libcore/slice/mod.rs:2448
|
||||
10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
|
||||
at libcore/slice/mod.rs:2316
|
||||
11: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
|
||||
at liballoc/vec.rs:1653
|
||||
12: panic::main
|
||||
at src/main.rs:4
|
||||
13: std::rt::lang_start::{{closure}}
|
||||
at libstd/rt.rs:74
|
||||
14: std::panicking::try::do_call
|
||||
at libstd/rt.rs:59
|
||||
at libstd/panicking.rs:310
|
||||
15: macho_symbol_search
|
||||
at libpanic_unwind/lib.rs:102
|
||||
16: std::alloc::default_alloc_error_hook
|
||||
at libstd/panicking.rs:289
|
||||
at libstd/panic.rs:392
|
||||
at libstd/rt.rs:58
|
||||
17: std::rt::lang_start
|
||||
at libstd/rt.rs:74
|
||||
18: panic::main
|
||||
```
|
||||
@@ -102,7 +102,7 @@ $ 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', libcore/slice/mod.rs:2046:10
|
||||
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', libcore/slice/mod.rs:2448:10
|
||||
note: Run with `RUST_BACKTRACE=1` for a backtrace.
|
||||
```
|
||||
|
||||
@@ -127,7 +127,7 @@ Listing 9-2 shows output similar to what you’ll see.
|
||||
$ RUST_BACKTRACE=1 cargo run
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
|
||||
Running `target/debug/panic`
|
||||
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', libcore/slice/mod.rs:2046:10
|
||||
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', libcore/slice/mod.rs:2448:10
|
||||
stack backtrace:
|
||||
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
|
||||
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
|
||||
@@ -138,22 +138,22 @@ stack backtrace:
|
||||
at libstd/panicking.rs:211
|
||||
3: std::panicking::default_hook
|
||||
at libstd/panicking.rs:227
|
||||
4: std::panicking::rust_panic_with_hook
|
||||
at libstd/panicking.rs:477
|
||||
4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
|
||||
at libstd/panicking.rs:476
|
||||
5: std::panicking::continue_panic_fmt
|
||||
at libstd/panicking.rs:391
|
||||
6: rust_begin_unwind
|
||||
at libstd/panicking.rs:326
|
||||
7: core::panicking::panic_fmt
|
||||
at libstd/panicking.rs:390
|
||||
6: std::panicking::try::do_call
|
||||
at libstd/panicking.rs:325
|
||||
7: core::ptr::drop_in_place
|
||||
at libcore/panicking.rs:77
|
||||
8: core::panicking::panic_bounds_check
|
||||
8: core::ptr::drop_in_place
|
||||
at libcore/panicking.rs:59
|
||||
9: <usize as core::slice::SliceIndex<[T]>>::index
|
||||
at libcore/slice/mod.rs:2046
|
||||
at libcore/slice/mod.rs:2448
|
||||
10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
|
||||
at libcore/slice/mod.rs:1914
|
||||
at libcore/slice/mod.rs:2316
|
||||
11: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
|
||||
at liballoc/vec.rs:1725
|
||||
at liballoc/vec.rs:1653
|
||||
12: panic::main
|
||||
at src/main.rs:4
|
||||
13: std::rt::lang_start::{{closure}}
|
||||
@@ -161,17 +161,15 @@ stack backtrace:
|
||||
14: std::panicking::try::do_call
|
||||
at libstd/rt.rs:59
|
||||
at libstd/panicking.rs:310
|
||||
15: __rust_maybe_catch_panic
|
||||
at libpanic_unwind/lib.rs:103
|
||||
16: std::rt::lang_start_internal
|
||||
15: macho_symbol_search
|
||||
at libpanic_unwind/lib.rs:102
|
||||
16: std::alloc::default_alloc_error_hook
|
||||
at libstd/panicking.rs:289
|
||||
at libstd/panic.rs:392
|
||||
at libstd/rt.rs:58
|
||||
17: std::rt::lang_start
|
||||
at libstd/rt.rs:74
|
||||
18: main
|
||||
19: __libc_start_main
|
||||
20: _start
|
||||
18: panic::main
|
||||
```
|
||||
|
||||
<span class="caption">Listing 9-2: The backtrace generated by a call to
|
||||
|
||||
Reference in New Issue
Block a user