Skip to content
Closed
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
7 changes: 5 additions & 2 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ pub fn build_output_filenames(input: &Input,
// We want to toss everything after the final '.'
let dirpath = match *odir {
Some(ref d) => d.clone(),
None => PathBuf::new(".")
None => PathBuf::new("")
};

// If a crate name is present, we use it as the link name
Expand All @@ -954,8 +954,11 @@ pub fn build_output_filenames(input: &Input,
if *odir != None {
sess.warn("ignoring --out-dir flag due to -o flag.");
}

let cur_dir = Path::new("");

OutputFilenames {
out_directory: out_file.parent().unwrap().to_path_buf(),
out_directory: out_file.parent().unwrap_or(cur_dir).to_path_buf(),
out_filestem: out_file.file_stem().unwrap()
.to_str().unwrap().to_string(),
single_output_file: ofile,
Expand Down
4 changes: 4 additions & 0 deletions src/test/run-make/bare-outfile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-include ../tools.mk

all:
$(rustc) -o foo foo.rs
12 changes: 12 additions & 0 deletions src/test/run-make/bare-outfile/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2015 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() {
}