Skip to content

Commit 66849de

Browse files
committed
Auto merge of #1396 - alexcrichton:issue-1390, r=huonw
When calculating the output directory filename, only use the "file name" component of the target triple specified as otherwise the output could be placed into an odd location. Closes #1390
2 parents e4f0662 + 29b24cd commit 66849de

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cargo/ops/cargo_rustc/layout.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ pub struct LayoutProxy<'a> {
6969
impl Layout {
7070
pub fn new(pkg: &Package, triple: Option<&str>, dest: &str) -> Layout {
7171
let mut path = pkg.absolute_target_dir();
72-
match triple {
73-
Some(s) => path.push(s),
74-
None => {}
72+
// Flexible target specifications often point at filenames, so interpret
73+
// the target triple as a Path and then just use the file stem as the
74+
// component for the directory name.
75+
if let Some(triple) = triple {
76+
path.push(Path::new(triple).file_stem().unwrap());
7577
}
7678
path.push(dest);
7779
Layout::at(path)

0 commit comments

Comments
 (0)