Skip to content

Commit fa0834d

Browse files
committed
rustc_back: Don't pass 'u' to ar invocations
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
1 parent c654a07 commit fa0834d

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

Diff for: src/librustc_back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'a> Archive<'a> {
152152
cmd.arg("d").arg(dst).arg(file);
153153
}
154154
Action::AddObjects(objs, update_symbols) => {
155-
cmd.arg(if update_symbols {"crus"} else {"cruS"})
155+
cmd.arg(if update_symbols {"crs"} else {"crS"})
156156
.arg(dst)
157157
.args(objs);
158158
}

Diff for: src/test/auxiliary/issue-18913-1.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// no-prefer-dynamic
12+
13+
#![crate_type = "rlib"]
14+
#![crate_name = "foo"]
15+
16+
pub fn foo() -> i32 { 0 }

Diff for: src/test/auxiliary/issue-18913-2.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// no-prefer-dynamic
12+
13+
#![crate_type = "rlib"]
14+
#![crate_name = "foo"]
15+
16+
pub fn foo() -> i32 { 1 }

Diff for: src/test/run-pass/issue-18913.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-18913-1.rs
12+
// aux-build:issue-18913-2.rs
13+
14+
extern crate foo;
15+
16+
fn main() {
17+
assert_eq!(foo::foo(), 1);
18+
}

0 commit comments

Comments
 (0)