Closed
Description
Code
rustc -C help | cmd /c exit
After more testing, this only reproduces consistently under cmd, as other Windows shells have diverging behavior about what it means to close a pipe via program termination 🙃
rustc --help | cmd /c exit
does not panic, but this appears to be not because of rustc doing anything different, but because rustc
finishes writing to stdout before it is closed.
Meta
Note: never occurs under #[cfg(unix)]
, as rustc sets SIGPIPE
to SIG_DFL
.
rustc_driver::set_sigpipe_handler
rust/compiler/rustc_driver/src/lib.rs
Lines 433 to 440 in 7f08d04
rustc --version --verbose
:
rustc 1.63.0-nightly (dc80ca78b 2022-06-21)
binary: rustc
commit-hash: dc80ca78b6ec2b6bba02560470347433bcd0bb3c
commit-date: 2022-06-21
host: x86_64-pc-windows-msvc
release: 1.63.0-nightly
LLVM version: 14.0.5
Error output
thread 'main' panicked at 'failed printing to stdout: The pipe is being closed. (os error 232)', library\std\src\io\stdio.rs:1015:9
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.63.0-nightly (dc80ca78b 2022-06-21) running on x86_64-pc-windows-msvc
note: compiler flags: -C help
query stack during panic:
end of query stack
Backtrace
stack backtrace:
0: 0x7ffecbca9dff - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h46bec461e9e7ac22
1: 0x7ffecbce4a4a - core::fmt::write::h2cf2927a9deb2e17
2: 0x7ffecbc9c2e9 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hfd12a4a4f03cb21d
3: 0x7ffecbcad6eb - std::panicking::default_hook::h22600ff9cff4f04f
4: 0x7ffecbcad36b - std::panicking::default_hook::h22600ff9cff4f04f
5: 0x7ffe8f597f06 - rustc_driver[9e128b4dc2b1f3f4]::pretty::print_after_hir_lowering
6: 0x7ffecbcade92 - std::panicking::rust_panic_with_hook::hf01515033fcb4adb
7: 0x7ffecbcadc2d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h8d0ff84b444c4809
8: 0x7ffecbcaaa37 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h46bec461e9e7ac22
9: 0x7ffecbcad909 - rust_begin_unwind
11: 0x7ffecbc9a185 - std::io::stdio::_print::heedac1eb9faaac98
12: 0x7ffe8f5a34b3 - rustc_driver[9e128b4dc2b1f3f4]::handle_options
13: 0x7ffe8f598e68 - <rustc_driver[9e128b4dc2b1f3f4]::RunCompiler>::run
14: 0x7ffe8f5203be - <rustc_ast_passes[ccae167a3a40ca07]::node_count::NodeCounter as rustc_ast[f496af66d74beb8c]::visit::Visitor>::visit_attribute
15: 0x7ffe8f5a54fb - rustc_driver[9e128b4dc2b1f3f4]::main
16: 0x7ff7e017100e - <unknown>
17: 0x7ff7e0171076 - <unknown>
18: 0x7ff7e017105c - <unknown>
19: 0x7ffecbc8c0b1 - std::rt::lang_start_internal::h562b7c63b69fd4a3
20: 0x7ff7e0171037 - <unknown>
21: 0x7ff7e0171284 - <unknown>
22: 0x7fff0f1b54e0 - BaseThreadInitThunk
23: 0x7fff1130485b - RtlUserThreadStart