Skip to content

Commit

Permalink
fix #26092 by returning an empty OS string when the output file path …
Browse files Browse the repository at this point in the history
…has no file_stem
  • Loading branch information
swgillespie committed Jun 11, 2015
1 parent ae8a3c9 commit 91effb3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use super::Compilation;
use serialize::json;

use std::env;
use std::ffi::OsString;
use std::ffi::{OsString, OsStr};
use std::fs;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -966,7 +966,7 @@ pub fn build_output_filenames(input: &Input,

OutputFilenames {
out_directory: out_file.parent().unwrap_or(cur_dir).to_path_buf(),
out_filestem: out_file.file_stem().unwrap()
out_filestem: out_file.file_stem().unwrap_or(OsStr::new(""))
.to_str().unwrap().to_string(),
single_output_file: ofile,
extra: sess.opts.cg.extra_filename.clone(),
Expand Down
5 changes: 5 additions & 0 deletions src/test/run-make/issue-26092/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-include ../tools.mk

all:
$(RUSTC) -o "" blank.rs 2>&1 | \
grep 'No such file or directory'
11 changes: 11 additions & 0 deletions src/test/run-make/issue-26092/blank.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {}

0 comments on commit 91effb3

Please sign in to comment.