Skip to content

Commit 8ac528b

Browse files
committed
rustc: Fix an ICE when -o bare-path
rustc will ICE if you specify an outfile path that is bare without a directory. As a workaround, before this -o ./foo will work
1 parent 668c647 commit 8ac528b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc_driver/driver.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,11 @@ pub fn build_output_filenames(input: &Input,
954954
if *odir != None {
955955
sess.warn("ignoring --out-dir flag due to -o flag.");
956956
}
957+
958+
let cur_dir = Path::new("");
959+
957960
OutputFilenames {
958-
out_directory: out_file.parent().unwrap().to_path_buf(),
961+
out_directory: out_file.parent().unwrap_or(cur_dir).to_path_buf(),
959962
out_filestem: out_file.file_stem().unwrap()
960963
.to_str().unwrap().to_string(),
961964
single_output_file: ofile,

0 commit comments

Comments
 (0)