Skip to content

Cargo build ICE when run with closed STDIN #60447

Closed
@ooprala

Description

@ooprala

How to reproduce

cargo new any_project
cd any_project
cargo build <&-
# the &- syntax (valid in bash and zsh AFAIK)
# tells your shell to fork cargo with STDIN *closed*

Actual Result

thread '<unnamed>' panicked at 'failed to acquire jobserver token: early EOF on jobserver pipe', error: failed to acquire jobserver token: early EOF on jobserver pipe
src/librustc_codegen_ssa/back/write.rs:1406:29

note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error

error: Could not compile `any_project`.

To learn more, run the command again with --verbose.

Actual Result with full backtrace

thread '<unnamed>' panicked at 'failed to acquire jobserver token: early EOF on jobserver pipe', src/librustc_codegen_ssa/back/write.rs:1406:29
error: failed to acquire jobserver token: early EOF on jobserver pipe

stack backtrace:
   0:     0x7fa5eca1ce63 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hc7b76c57e25c7d91
                               at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1:     0x7fa5eca1556b - std::sys_common::backtrace::_print::h203699a8f1b8b948
                               at src/libstd/sys_common/backtrace.rs:70
   2:     0x7fa5eca190c6 - std::panicking::default_hook::{{closure}}::h74fcb67c61dc8b92
                               at src/libstd/sys_common/backtrace.rs:58
                               at src/libstd/panicking.rs:200
   3:     0x7fa5eca18e44 - std::panicking::default_hook::hb2e06978a2102930
                               at src/libstd/panicking.rs:215
   4:     0x7fa5e8bb03df - rustc::util::common::panic_hook::h9fd4a470400ba35c
   5:     0x7fa5eca198b8 - std::panicking::rust_panic_with_hook::h4ac0b487eb7e54da
                               at src/libstd/panicking.rs:482
   6:     0x7fa5eca19351 - std::panicking::continue_panic_fmt::h23ca3ed77b25f368
                               at src/libstd/panicking.rs:385
   7:     0x7fa5eca1929e - std::panicking::begin_panic_fmt::he14137966dec33cc
                               at src/libstd/panicking.rs:340
   8:     0x7fa5e310477b - std::sys_common::backtrace::__rust_begin_short_backtrace::h6be5ab22ff539cca
   9:     0x7fa5e3146cad - std::panicking::try::do_call::hb93197db26b32ea9
  10:     0x7fa5eca2ab29 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:87
  11:     0x7fa5e31105f8 - <F as alloc::boxed::FnBox<A>>::call_box::haaff0e1f36b63d07
  12:     0x7fa5eca2986d - std::sys::unix::thread::Thread::new::thread_start::h7fc2d82a3b91bc88
                               at /rustc/fc50f328b0353b285421b8ff5d4100966387a997/src/liballoc/boxed.rs:759
                               at src/libstd/sys_common/thread.rs:14
                               at src/libstd/sys/unix/thread.rs:81
  13:     0x7fa5ec960a91 - start_thread
  14:     0x7fa5ec87fcd2 - __clone
  15:                0x0 - <unknown>
query stack during panic:
end of query stack
error: aborting due to previous error

error: Could not compile `any_project`.

To learn more, run the command again with --verbose.

rustc --version --verbose

rustc 1.34.1 (fc50f328b 2019-04-24)
binary: rustc
commit-hash: fc50f328b0353b285421b8ff5d4100966387a997
commit-date: 2019-04-24
host: x86_64-unknown-linux-gnu
release: 1.34.1
LLVM version: 8.0

Expected result

   Compiling any_project v0.1.0 (/tmp/any_project)
   Finished dev [unoptimized + debuginfo] target(s) in 0.33s

Additional details
Please note that the issue will go away once you succeed in building the project (probably thanks due to some compiler caching, sorry, not sure here).
A touch is enough to get the error back :)

touch src/main.rs

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions