If the path passed to -o only consists of a filename, rustc ICEs. It also ICEs when given a directory.
When given a filename:
doener@atjola:rust-play $ RUST_BACKTRACE=1 rustc -o hello hello.rs
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/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/option.rs:362
stack backtrace:
1: 0x7fcf576f72f2 - sys::backtrace::write::hd861c9cad5664affQBA
2: 0x7fcf5771d342 - panicking::on_panic::h2d36a117ae395cb9jHJ
3: 0x7fcf57663a89 - rt::unwind::begin_unwind_inner::h020c424433824dc2mnJ
4: 0x7fcf57663e31 - rt::unwind::begin_unwind_fmt::h48257c008f84b3a8XlJ
5: 0x7fcf5771cec7 - rust_begin_unwind
6: 0x7fcf57766864 - panicking::panic_fmt::h8bc4e151698a6d25HZs
7: 0x7fcf57763c4d - panicking::panic::h5f34a8b4b06c830dTXs
8: 0x7fcf57d01c5d - driver::build_output_filenames::hcff54084b24b392761a
9: 0x7fcf57cf66bf - driver::compile_input::h124aae68147ae8b8Nba
10: 0x7fcf57dbc15d - run_compiler::hffd5283ae5d6d3abG6b
11: 0x7fcf57db9ecc - thunk::F.Invoke<A, R>::invoke::h16438916220137010031
12: 0x7fcf57db8b20 - rt::unwind::try::try_fn::h17325604874211535233
13: 0x7fcf57789118 - rust_try_inner
14: 0x7fcf57789105 - rust_try
15: 0x7fcf57db92ab - thunk::F.Invoke<A, R>::invoke::h5807416775295653773
16: 0x7fcf5770ab45 - sys::thread::thread_start::h2188587ec04914c6t8E
17: 0x7fcf517720a3 - start_thread
18: 0x7fcf572e404c - __clone
19: 0x0 - <unknown>
When given a directory:
doener@atjola:rust-play $ RUST_BACKTRACE=1 rustc -o ../rust-play/ hello.rs
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/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/option.rs:362
stack backtrace:
1: 0x7f29445e52f2 - sys::backtrace::write::hd861c9cad5664affQBA
2: 0x7f294460b342 - panicking::on_panic::h2d36a117ae395cb9jHJ
3: 0x7f2944551a89 - rt::unwind::begin_unwind_inner::h020c424433824dc2mnJ
4: 0x7f2944551e31 - rt::unwind::begin_unwind_fmt::h48257c008f84b3a8XlJ
5: 0x7f294460aec7 - rust_begin_unwind
6: 0x7f2944654864 - panicking::panic_fmt::h8bc4e151698a6d25HZs
7: 0x7f2944651c4d - panicking::panic::h5f34a8b4b06c830dTXs
8: 0x7f2944befc76 - driver::build_output_filenames::hcff54084b24b392761a
9: 0x7f2944be46bf - driver::compile_input::h124aae68147ae8b8Nba
10: 0x7f2944caa15d - run_compiler::hffd5283ae5d6d3abG6b
11: 0x7f2944ca7ecc - thunk::F.Invoke<A, R>::invoke::h16438916220137010031
12: 0x7f2944ca6b20 - rt::unwind::try::try_fn::h17325604874211535233
13: 0x7f2944677118 - rust_try_inner
14: 0x7f2944677105 - rust_try
15: 0x7f2944ca72ab - thunk::F.Invoke<A, R>::invoke::h5807416775295653773
16: 0x7f29445f8b45 - sys::thread::thread_start::h2188587ec04914c6t8E
17: 0x7f293e6600a3 - start_thread
18: 0x7f29441d204c - __clone
19: 0x0 - <unknown>
Interestingly, it just does non-sense when the trailing slash is omitted:
doener@atjola:rust-play $ RUST_BACKTRACE=1 rustc -o ../rust-play hello.rs
hello.rs:2:3: 2:23 warning: use of unstable library feature 'old_io'
hello.rs:2 std::old_io::println("Hello world!");
^~~~~~~~~~~~~~~~~~~~
hello.rs:2:23: 2:23 help: add #![feature(old_io)] to the crate attributes to silence this warning
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "../rust-play" "../rust-play.o" "-Wl,--whole-archive" "-lmorestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-4e7c5e5c.rlib" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4e7c5e5c.rlib" "-L" "/home/doener/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/doener/src/rust-play/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/doener/src/rust-play/lib/x86_64-unknown-linux-gnu" "-Wl,--whole-archive" "-Wl,-Bstatic" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-ldl" "-lpthread" "-lrt" "-lgcc_s" "-lpthread" "-lc" "-lm" "-Wl,-rpath,$ORIGIN/../.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lcompiler-rt"
note: /usr/bin/ld: cannot open output file ../rust-play: Is a directory
collect2: error: ld returned 1 exit status
error: aborting due to previous error
If the path passed to
-oonly consists of a filename, rustc ICEs. It also ICEs when given a directory.When given a filename:
When given a directory:
Interestingly, it just does non-sense when the trailing slash is omitted: