Skip to content

Commit

Permalink
rustc_back: Don't pass 'u' to ar invocations
Browse files Browse the repository at this point in the history
This flag indicates that when files are being replaced or added to archives (the
`r` flag) that the new file should not be inserted if it is not newer than the
file that already exists in the archive. The compiler never actually has a use
case of *not* wanting to insert a file because it already exists, and this
causes rlibs to not be updated in some cases when the compiler was re-run too
quickly.

Closes #18913
  • Loading branch information
alexcrichton committed May 26, 2015
1 parent c654a07 commit fa0834d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<'a> Archive<'a> {
cmd.arg("d").arg(dst).arg(file);
}
Action::AddObjects(objs, update_symbols) => {
cmd.arg(if update_symbols {"crus"} else {"cruS"})
cmd.arg(if update_symbols {"crs"} else {"crS"})
.arg(dst)
.args(objs);
}
Expand Down
16 changes: 16 additions & 0 deletions src/test/auxiliary/issue-18913-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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.

// no-prefer-dynamic

#![crate_type = "rlib"]
#![crate_name = "foo"]

pub fn foo() -> i32 { 0 }
16 changes: 16 additions & 0 deletions src/test/auxiliary/issue-18913-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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.

// no-prefer-dynamic

#![crate_type = "rlib"]
#![crate_name = "foo"]

pub fn foo() -> i32 { 1 }
18 changes: 18 additions & 0 deletions src/test/run-pass/issue-18913.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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.

// aux-build:issue-18913-1.rs
// aux-build:issue-18913-2.rs

extern crate foo;

fn main() {
assert_eq!(foo::foo(), 1);
}

0 comments on commit fa0834d

Please sign in to comment.