Skip to content

ICE when using \\.\NUL as the input filename on Windows #128681

Closed
@ChrisDenton

Description

@ChrisDenton

Code

On a Windows machine, run:

rustc \\.\NUL

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (176e54520 2024-08-04)
binary: rustc
commit-hash: 176e5452095444815207be02c16de0b1487a1b53
commit-date: 2024-08-04
host: x86_64-pc-windows-msvc
release: 1.82.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler\rustc_session\src\config.rs:842:57:
called `Option::unwrap()` on a `None` value

Which is here:

Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap(),

Specifically the file_stem().unwrap() panics. The \\.\NUL device is pretty weird as it's a device in its own right that you can read/write to but also a kind of root directory (you can do \\.\NUL\path\to\rust.rs) and calling parent() on \\.\NUL should return None. It doesn't quite fit with std's model of paths.

Backtrace

thread 'rustc' panicked at compiler\rustc_session\src\config.rs:842:57:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ffd5681d903 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffd5681d903 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffd5681d903 - std::backtrace::Backtrace::create
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\backtrace.rs:331
   3:     0x7ffd5681d84a - std::backtrace::Backtrace::force_capture
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\backtrace.rs:312
   4:     0x7ffceb7fcef9 - memchr
   5:     0x7ffd5683871b - alloc::boxed::impl$50::call
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2164
   6:     0x7ffd5683871b - std::panicking::rust_panic_with_hook
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:805
   7:     0x7ffd568384ef - std::panicking::begin_panic_handler::closure$0
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:664
   8:     0x7ffd5683569f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\sys\backtrace.rs:170
   9:     0x7ffd56838136 - std::panicking::begin_panic_handler
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:662
  10:     0x7ffd56890c94 - core::panicking::panic_fmt
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\panicking.rs:74
  11:     0x7ffd56890d3d - core::panicking::panic
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\panicking.rs:148
  12:     0x7ffd56890bfe - core::option::unwrap_failed
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\option.rs:2017
  13:     0x7ffcecea3774 - <rustc_session[2d2a655f635f0202]::config::Input>::filestem
  14:     0x7ffce7350e81 - rustc_interface[386d7deb044bc41f]::util::build_output_filenames
  15:     0x7ffce73497ea - <rustc_interface[386d7deb044bc41f]::queries::Queries>::global_ctxt
  16:     0x7ffce7303523 - _wpgmptr
  17:     0x7ffce72ff27f - _wpgmptr
  18:     0x7ffce730cf5b - _wpgmptr
  19:     0x7ffd56849acd - alloc::boxed::impl$48::call_once
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2150
  20:     0x7ffd56849acd - alloc::boxed::impl$48::call_once
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2150
  21:     0x7ffd56849acd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\sys\pal\windows\thread.rs:55
  22:     0x7ffda697257d - BaseThreadInitThunk
  23:     0x7ffda7caaf28 - RtlUserThreadStart


rustc version: 1.82.0-nightly (176e54520 2024-08-04)
platform: x86_64-pc-windows-msvc

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-windowsOperating system: WindowsP-lowLow 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