Skip to content

Commit c1a5a47

Browse files
committed
Auto merge of #2316 - alexcrichton:update, r=alexcrichton
A few small tweaks to tests were necessary to accomodate rust-lang/rust#29520, and a few changes were made to the code to account for that as well.
2 parents 859c5d3 + 3194a23 commit c1a5a47

6 files changed

+18
-13
lines changed

src/cargo/ops/cargo_rustc/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
221221
///
222222
/// If `plugin` is true, the pair corresponds to the host platform,
223223
/// otherwise it corresponds to the target platform.
224-
fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
224+
pub fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
225225
let (triple, pair) = if kind == Kind::Host {
226226
(&self.config.rustc_info().host, &self.host_staticlib)
227227
} else {

src/cargo/ops/cargo_rustc/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,11 @@ fn build_deps_args(cmd: &mut CommandPrototype, cx: &Context, unit: &Unit)
574574
let layout = cx.layout(unit.pkg, unit.kind);
575575

576576
for filename in try!(cx.target_filenames(unit)) {
577-
if filename.ends_with(".a") { continue }
577+
if let Ok((prefix, suffix)) = cx.staticlib(unit.kind) {
578+
if filename.starts_with(prefix) && filename.ends_with(suffix) {
579+
continue
580+
}
581+
}
578582
let mut v = OsString::new();
579583
v.push(&unit.target.crate_name());
580584
v.push("=");

src/rustversion.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2015-11-30
1+
2016-01-25

tests/test_cargo_compile.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1738,13 +1738,12 @@ test!(predictable_filenames {
17381738
17391739
[lib]
17401740
name = "foo"
1741-
crate-type = ["staticlib", "dylib", "rlib"]
1741+
crate-type = ["dylib", "rlib"]
17421742
"#)
17431743
.file("src/lib.rs", "");
17441744

17451745
assert_that(p.cargo_process("build").arg("-v"),
17461746
execs().with_status(0));
1747-
assert_that(&p.root().join("target/debug/libfoo.a"), existing_file());
17481747
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
17491748
let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX,
17501749
env::consts::DLL_SUFFIX);

tests/test_cargo_compile_custom_build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,8 @@ test!(build_script_with_dynamic_native_dependency {
11351135
"#)
11361136
.file("bar/src/lib.rs", r#"
11371137
pub fn bar() {
1138-
#[link(name = "builder")]
1138+
#[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
1139+
#[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
11391140
extern { fn foo(); }
11401141
unsafe { foo() }
11411142
}

tests/test_cargo_compile_plugins.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,21 @@ test!(plugin_with_dynamic_native_dependency {
152152
.display());
153153
}
154154
"#)
155-
.file("bar/src/lib.rs", &format!(r#"
155+
.file("bar/src/lib.rs", r#"
156156
#![feature(plugin_registrar, rustc_private)]
157157
extern crate rustc_plugin;
158158
159159
use rustc_plugin::Registry;
160160
161-
#[link(name = "{}")]
162-
extern {{ fn foo(); }}
161+
#[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
162+
#[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
163+
extern { fn foo(); }
163164
164165
#[plugin_registrar]
165-
pub fn bar(_reg: &mut Registry) {{
166-
unsafe {{ foo() }}
167-
}}
168-
"#, libname));
166+
pub fn bar(_reg: &mut Registry) {
167+
unsafe { foo() }
168+
}
169+
"#);
169170

170171
assert_that(foo.cargo_process("build").env("SRC", &lib).arg("-v"),
171172
execs().with_status(0));

0 commit comments

Comments
 (0)