Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSet RUST_BACKTRACE=1 when running programs #1517
Comments
huonw
added
the
Command-run
label
Apr 12, 2015
This comment has been minimized.
This comment has been minimized.
|
I would personally be pretty surprised by this behavior as Cargo wants to be as thin a shim as possible on top of running a program. Adding this sort of behavior would inevitable lead to the need for further configuration (such as leaving the environment variable off with Perhaps the discoverability problem could be solved rather than adding special logic to cargo? |
This comment has been minimized.
This comment has been minimized.
|
What would be the recommendation for users? Have |
This comment has been minimized.
This comment has been minimized.
|
I would recommend setting it when needed, although having a global I see this as a downside as it is affecting behavior in a way that will need further configuration to revert back to the default behavior today. |
This comment has been minimized.
This comment has been minimized.
|
I was asking about downside of setting backtrace on, becaue if it shouldn't be set all the time, then cargo is in unique position to set it for the program being run, but not for rustc and the cargo itself. |
This comment has been minimized.
This comment has been minimized.
|
The downside is that if you don't want it set, Cargo needs to grow its own configuration to not pass the environment variable, which is more surface area to work through and not necessarily worth it. |
This comment has been minimized.
This comment has been minimized.
|
Could you check for and honor |
This comment has been minimized.
This comment has been minimized.
|
Right, but this rabbit hole keeps going because what if the integer being passed to |
This comment has been minimized.
This comment has been minimized.
|
OK |
kornelski commentedApr 12, 2015
RUST_BACKTRACE=1is super-useful, but not very discoverable. It's a trick I wish I knew earlier.Currently rust has very unhelpful error messages in many common cases, because assertions in the stdlib point to code inside stdlib, rather than user's code that is the root cause of the problem. Backtrace output is essential to diagnose problems.
Cargo could be helpful here and set
RUST_BACKTRACE=1automatically when running examples and binaries.If having it on all the time is a problem, then it could be disabled in
--releaseor enabled with--verbose(which would make it more meaningful than #1516) — these flags are still more discoverable than an environmental variable.