Documentation for the `RUST_BACKTRACE` environment variable is superficial and hard to find
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Summary
When panicking a Rust-made binary, for example with:
echo 'fn main() { panic!(); }' | rustc - && ./rust_out
The crash message advices to use RUST_BACKTRACE for getting the backtrace:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Or following the advice, further help for getting a verbose backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Getting this info from the compiled binary is great, but it would be good to have the information
available in the web documentation as well. Currently, it is both a bit hard to locate from the
official documentation resources and not very thorough.
Some official documentation that does mention RUST_BACKTRACE:
- The best documentation currently lives in The Rust Programming Language book.
- Some details can be found in the standard library documentation, although you
[need][std-search-no-results] to use an external search engine for that. - The Rust Unstable Book currently says that the environment variable has no
documentation, and therefore is likely internal to the compiler and not meant for general use.
I think it would be useful to have public documentation for at least the same things that the binary
says. A brief mention in the Rust Reference about the generated binary's traceback
capabilities' availability under certain circumstances would not seem out-of-place to me.
@rustbot label +A-backtrace
[std-search-no-results]: https://doc.rust-lang.org/std/backtrace/?search=RUST_BACKTRACE
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the linked Rust Book, standard library backtrace documentation, Unstable Book entry, and Rust Reference to determine the best public location and current coverage. Document the supported RUST_BACKTRACE values and the conditions for obtaining normal and verbose backtraces, with the information easy to find from official documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100