rust/src/libstd
bors f2285bdaf5 Auto merge of #32549 - respeccing:rust_backtrace_disabled, r=alexcrichton
allow RUST_BACKTRACE=0 to act as if unset

**UPDATE:** `RUST_BACKTRACE=0` to act as if the env. var is unset! (now `0` is what `disabled` was for, below)

When RUST_BACKTRACE is set to "disabled" then this acts as if the env. var is unset. So, either make sure `RUST_BACKTRACE` is not set OR set it to `disabled` to achieve the same effect.

Sample usage:

```bash
$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=disabled /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=1 /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
stack backtrace:
   1:     0x55709e8148c0 - sys::backtrace::tracing:👿:write::h140f24a0cfc189b98Ru
   2:     0x55709e816a5b - panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::closure.45165
   3:     0x55709e8166e8 - panicking::default_hook::hed419823688cb82aXoA
   4:     0x55709e810fff - sys_common::unwind::begin_unwind_inner::hbb9642f6e212d56fmHt
   5:     0x55709e810513 - sys_common::unwind::begin_unwind::h16232867470678019594
   6:     0x55709e810489 - main::hb524f9576270962feaa
   7:     0x55709e816314 - sys_common::unwind::try::try_fn::h1274188004693518534
   8:     0x55709e813dfb - __rust_try
   9:     0x55709e815dab - rt::lang_start::h712b1cd650781872ahA
  10:     0x55709e810679 - main
  11:     0x7efd1026859f - __libc_start_main
  12:     0x55709e810348 - _start
  13:                0x0 - <unknown>
```

Some programs(eg. [vim's syntactic](https://github.com/scrooloose/syntastic) used by [rust.vim](https://github.com/rust-lang/rust.vim)) cannot unset the env. var RUST_BACKTRACE if it's already set(eg. in .bashrc) but [they can set it to some value](cb5533e159/system/Z575/OSes/gentoo/on_baremetal/filesystem_now/gentoo/home/zazdxscf/build/1nonpkgs/rust.vim/upd (L17)), and I needed to ensure the env. var is unset in order to avoid this issue: https://github.com/rust-lang/rust/issues/29293

**EDIT:** Sample usage 2:

```bash
$ export RUST_BACKTRACE=1

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
stack backtrace:
   1:     0x55c2696738c0 - sys::backtrace::tracing:👿:write::h140f24a0cfc189b98Ru
   2:     0x55c269675a5b - panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::closure.45165
   3:     0x55c2696756e8 - panicking::default_hook::hed419823688cb82aXoA
   4:     0x55c26966ffff - sys_common::unwind::begin_unwind_inner::hbb9642f6e212d56fmHt
   5:     0x55c26966f513 - sys_common::unwind::begin_unwind::h16023941661074805588
   6:     0x55c26966f489 - main::hb524f9576270962feaa
   7:     0x55c269675314 - sys_common::unwind::try::try_fn::h1274188004693518534
   8:     0x55c269672dfb - __rust_try
   9:     0x55c269674dab - rt::lang_start::h712b1cd650781872ahA
  10:     0x55c26966f679 - main
  11:     0x7f593d58459f - __libc_start_main
  12:     0x55c26966f348 - _start
  13:                0x0 - <unknown>

$ rustc -o /tmp/a.out -- <(echo 'fn main(){ panic!() }') && RUST_BACKTRACE=disabled /tmp/a.out
!! executing '/home/zazdxscf/build/1nonpkgs/rust/rust//x86_64-unknown-linux-gnu/stage2/bin//rustc' with args: '-o /tmp/a.out -- /dev/fd/63'
thread '<main>' panicked at 'explicit panic', /dev/fd/63:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

```
2016-04-02 01:47:59 -07:00
..
collections Test that HashMap, HashSet, and their iterators are properly covariant 2016-03-30 22:02:36 -05:00
ffi Auto merge of #32454 - eddyb:rollup, r=eddyb 2016-03-23 12:33:04 -07:00
io Auto merge of #32541 - troplin:chain-bufread, r=alexcrichton 2016-03-29 01:21:30 -07:00
net Auto merge of #32334 - tbu-:pr_ipv6_octets, r=aturon 2016-04-01 20:38:52 -07:00
num fallout in existing tests 2016-03-25 06:45:42 -04:00
os Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichton 2016-03-08 01:04:36 +00:00
prelude End stdlib module summaries with a full stop. 2016-03-04 17:37:11 -05:00
rand std: restructure rand os code into sys modules 2016-02-17 16:21:32 -08:00
sync Rollup merge of #32507 - klingtnet:master, r=steveklabnik 2016-03-28 13:48:28 -04:00
sys Auto merge of #32549 - respeccing:rust_backtrace_disabled, r=alexcrichton 2016-04-02 01:47:59 -07:00
thread Fix unsound behaviour with null characters in thread names (issue #32475) 2016-03-25 06:14:03 +01:00
time Rollup merge of #32448 - sfackler:time-augmented-assignment, r=alexcrichton 2016-03-26 13:42:03 +05:30
ascii.rs Rollup merge of #32387 - alexcrichton:ascii-test, r=aturon 2016-03-26 20:35:49 +05:30
build.rs std: Link to gcc_s on NetBSD 2016-03-21 11:23:44 -07:00
Cargo.toml rustbuild: Sync some Cargo.toml/lib.rs dependencies 2016-02-21 09:49:13 -08:00
env.rs doc: "of the" seems more correct than "to the" 2016-03-30 09:01:22 +02:00
error.rs Impl Error for Box<T: Error> 2016-01-23 09:03:09 +01:00
fs.rs try! -> ? 2016-03-22 22:01:37 -05:00
lib.rs Extend linkchecker with anchor checking 2016-03-27 00:21:00 +01:00
macros.rs mk: Distribute fewer TARGET_CRATES 2016-03-07 13:05:12 -08:00
memchr.rs Minor spelling fixes 2016-02-09 11:52:39 -05:00
panic.rs try! -> ? 2016-03-22 22:01:37 -05:00
panicking.rs Make set_hook take a Box<Fn> 2016-03-15 20:51:48 -07:00
path.rs std: Clean out deprecated APIs 2016-03-12 12:31:13 -08:00
primitive_docs.rs doc: small char improvements 2016-03-22 08:29:55 +02:00
process.rs Rollup merge of #32257 - alexcrichton:fix-status-stdin, r=aturon 2016-03-26 09:07:21 +05:30
rt.rs Fix warnings when compiling stdlib with --test 2015-12-29 16:07:01 +01:00
rtdeps.rs bootstrap: Add directives to not double-link libs 2016-02-11 11:12:32 -08:00