Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,14 @@ pub enum Input {

impl Input {
pub fn filestem(&self) -> &str {
match *self {
Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap(),
Input::Str { .. } => "rust_out",
if let Input::File(ifile) = self {
// If for some reason getting the file stem as a UTF-8 string fails,
// then fallback to a fixed name.
if let Some(name) = ifile.file_stem().and_then(OsStr::to_str) {
return name;
}
}
"rust_out"
}

pub fn source_name(&self) -> FileName {
Expand Down
13 changes: 13 additions & 0 deletions tests/run-make/dos-device-input/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ only-windows
// Reason: dos devices are a Windows thing

use std::path::Path;

use run_make_support::{rustc, static_lib_name};

fn main() {
rustc().input(r"\\.\NUL").crate_type("staticlib").run();
rustc().input(r"\\?\NUL").crate_type("staticlib").run();

assert!(Path::new(&static_lib_name("rust_out")).exists());
}
Loading