rust/src/rustc
kennytm ccd2c403ac
Rollup merge of #49606 - varkor:pipe-repair, r=alexcrichton
Prevent broken pipes causing ICEs

As the private `std::io::print_to` panics if there is an I/O error, which is used by `println!`, the compiler would ICE if one attempted to use a broken pipe (e.g. `rustc --help | false`). This introduces a new (private) macro `try_println!` which allows us to avoid this.

As a side note, it seems this macro might be useful publicly (and actually there seems to be [a crate specifically for this purpose](https://crates.io/crates/try_print/)), though that can probably be left for a future discussion.

One slight alternative approach would be to simply early exit without an error (i.e. exit code `0`), which [this comment](https://github.com/rust-lang/rust/issues/34376#issuecomment-377822526) suggests is the usual approach. I've opted not to take that approach initially, because I think it's more helpful to know when there is a broken pipe.

Fixes #34376.
2018-04-17 01:50:58 +08:00
..
compiler_builtins_shim add a dist-thumb builder to build rust-std for the THUMB targets 2018-04-01 18:50:21 +02:00
dlmalloc_shim Update to most recent version of dlmalloc 2018-04-12 22:53:02 +02:00
libc_shim Inject the `compiler_builtins` crate whenever the `core` crate is injected 2018-04-07 09:24:35 +02:00
Cargo.toml
rustc.rs Rollup merge of #49606 - varkor:pipe-repair, r=alexcrichton 2018-04-17 01:50:58 +08:00