rust-lang / rust-lang/rust

Documentation for the `RUST_BACKTRACE` environment variable is superficial and hard to find

Open
#148,695 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-backtrace A-docs needs-triage T-libs
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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.