Comments (5)
I ran RUST_LIB_BACKTRACE=1 cargo run --release
in your repo at kurtbuilds/playground@64b7026 and I get a backtrace.
0: anyhow::error::<impl anyhow::Error>::msg
at /home/david/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.72/src/error.rs:83:36
1: playground::foo
at ./src/main.rs:4:16
2: playground::main
at ./src/main.rs:8:13
3: core::ops::function::FnOnce::call_once
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/ops/function.rs:250:5
4: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:135:18
5: std::rt::lang_start::{{closure}}
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/rt.rs:166:18
6: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/ops/function.rs:284:13
7: std::panicking::try::do_call
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:524:40
8: std::panicking::try
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:488:19
9: std::panic::catch_unwind
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panic.rs:142:14
10: std::rt::lang_start_internal::{{closure}}
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/rt.rs:148:48
11: std::panicking::try::do_call
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:524:40
12: std::panicking::try
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:488:19
13: std::panic::catch_unwind
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panic.rs:142:14
14: std::rt::lang_start_internal
at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/rt.rs:148:20
15: main
16: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
17: __libc_start_main_impl
at ./csu/../csu/libc-start.c:392:3
18: _start
rustc 1.73.0-nightly (32303b219 2023-07-29)
binary: rustc
commit-hash: 32303b219d4dffa447aa606bc11c7a648f44a862
commit-date: 2023-07-29
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
from anyhow.
It looks like that only works on nightly.
10:01:11 kurt@arcticfox:~/work/playground $ RUST_LIB_BACKTRACE=1 cargo run --release
Finished release [optimized + debuginfo] target(s) in 0.02s
Running `/Users/kurt/.cache/cargo/target/release/playground`
unsupported backtrace
10:01:20 kurt@arcticfox:~/work/playground $ RUST_LIB_BACKTRACE=1 cargo +nightly run --release
Compiling memchr v2.5.0
Compiling libc v0.2.147
Compiling cc v1.0.79
Compiling gimli v0.27.3
Compiling adler v1.0.2
Compiling cfg-if v1.0.0
Compiling anyhow v1.0.72
Compiling rustc-demangle v0.1.23
Compiling miniz_oxide v0.7.1
Compiling object v0.31.1
Compiling backtrace v0.3.68
Compiling addr2line v0.20.0
Compiling playground v0.1.0 (/Users/kurt/work/playground)
Finished release [optimized + debuginfo] target(s) in 3.56s
Running `/Users/kurt/.cache/cargo/target/release/playground`
0: std::backtrace_rs::backtrace::libunwind::trace
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: std::backtrace::Backtrace::create
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/backtrace.rs:332:13
3: anyhow::error::<impl anyhow::Error>::msg
at /Users/kurt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.72/src/error.rs:83:36
4: playground::foo
at ./src/main.rs:4:16
5: playground::main
at ./src/main.rs:8:13
6: core::ops::function::FnOnce::call_once
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/core/src/ops/function.rs:250:5
7: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/sys_common/backtrace.rs:135:18
8: std::rt::lang_start::{{closure}}
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/rt.rs:166:18
9: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/core/src/ops/function.rs:284:13
10: std::panicking::try::do_call
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panicking.rs:500:40
11: std::panicking::try
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panicking.rs:464:19
12: std::panic::catch_unwind
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panic.rs:142:14
13: std::rt::lang_start_internal::{{closure}}
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/rt.rs:148:48
14: std::panicking::try::do_call
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panicking.rs:500:40
15: std::panicking::try
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panicking.rs:464:19
16: std::panic::catch_unwind
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/panic.rs:142:14
17: std::rt::lang_start_internal
at /rustc/6bba061467f7c2cab04b262b95eb67bf89265587/library/std/src/rt.rs:148:20
18: _main
Is that expected? The docs say If using the nightly channel, or stable with features = ["backtrace"]
: https://docs.rs/anyhow/latest/anyhow/
from anyhow.
I can't reproduce this on macOS with nightly or stable, release or debug.
from anyhow.
That said backtraces on macOS are a bit weird, we don't 100% support them, see https://github.com/rust-lang/backtrace-rs/blob/0533d475a52389ea0612b5543316bb571afc30ac/src/backtrace/libunwind.rs#L58-L72 So maybe this is related to that, although this shouldn't return unsupported (it's more a case where we return incorrect values for some frames).
from anyhow.
I realized I was getting different behavior because I was using a different linker. Closing this, and thank you for help digging into this.
from anyhow.
Related Issues (20)
- Nightly feature wrongly enabled on stable toolchain HOT 3
- Should `anyhow::Error::chain` return `dyn Error + Send + Sync` HOT 2
- Customize backtrace logic?
- `anyhow!(e)` doesn't preserve `source` for `&Error` HOT 1
- A way to disable anyhow stacktraces (without disabling stacktraces from other crates) HOT 2
- Default Ok-type to `()` in `anyhow::Result` typedef HOT 2
- Updating from version 1.0.76 breaks backtraces HOT 2
- Make backtrace support optional HOT 10
- Possible performance regression on Windows HOT 5
- as_ref() type must be known at this point
- Depending on `CARGO_ENCODED_RUSTFLAGS` may produce stale builds HOT 1
- rust-analyzer nightly throws needless_return warning on bail! HOT 2
- Implement Context for Error
- Question regarding stacktrace
- anyhow::Error to Box<dyn Error> isn't compatible with other libraries HOT 2
- Are you open to de-duplicating the build.rs build probe code? HOT 7
- `anyhow::ensure!` doesn't work with custom error type HOT 1
- Short backtrace HOT 2
- Feature suggestion: ensure_some!() for unwrapping options HOT 3
- Cannot compile when using `ensure!` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anyhow.