diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 28881e7aad4..c85de27c4c8 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -221,7 +221,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { /// /// If `plugin` is true, the pair corresponds to the host platform, /// otherwise it corresponds to the target platform. - fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> { + pub fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> { let (triple, pair) = if kind == Kind::Host { (&self.config.rustc_info().host, &self.host_staticlib) } else { diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 17bd3647219..f76ba09e5c9 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -574,7 +574,11 @@ fn build_deps_args(cmd: &mut CommandPrototype, cx: &Context, unit: &Unit) let layout = cx.layout(unit.pkg, unit.kind); for filename in try!(cx.target_filenames(unit)) { - if filename.ends_with(".a") { continue } + if let Ok((prefix, suffix)) = cx.staticlib(unit.kind) { + if filename.starts_with(prefix) && filename.ends_with(suffix) { + continue + } + } let mut v = OsString::new(); v.push(&unit.target.crate_name()); v.push("="); diff --git a/src/rustversion.txt b/src/rustversion.txt index 5fdf51cb8f8..8af83b4bb4b 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-11-30 +2016-01-25 diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 2460a7b278f..6e33657759d 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1738,13 +1738,12 @@ test!(predictable_filenames { [lib] name = "foo" - crate-type = ["staticlib", "dylib", "rlib"] + crate-type = ["dylib", "rlib"] "#) .file("src/lib.rs", ""); assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0)); - assert_that(&p.root().join("target/debug/libfoo.a"), existing_file()); assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file()); let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 4778135ddbf..8d74e7de0ac 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -1135,7 +1135,8 @@ test!(build_script_with_dynamic_native_dependency { "#) .file("bar/src/lib.rs", r#" pub fn bar() { - #[link(name = "builder")] + #[cfg_attr(not(target_env = "msvc"), link(name = "builder"))] + #[cfg_attr(target_env = "msvc", link(name = "builder.dll"))] extern { fn foo(); } unsafe { foo() } } diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index dca74a6df87..d6f2143a89c 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -152,20 +152,21 @@ test!(plugin_with_dynamic_native_dependency { .display()); } "#) - .file("bar/src/lib.rs", &format!(r#" + .file("bar/src/lib.rs", r#" #![feature(plugin_registrar, rustc_private)] extern crate rustc_plugin; use rustc_plugin::Registry; - #[link(name = "{}")] - extern {{ fn foo(); }} + #[cfg_attr(not(target_env = "msvc"), link(name = "builder"))] + #[cfg_attr(target_env = "msvc", link(name = "builder.dll"))] + extern { fn foo(); } #[plugin_registrar] - pub fn bar(_reg: &mut Registry) {{ - unsafe {{ foo() }} - }} - "#, libname)); + pub fn bar(_reg: &mut Registry) { + unsafe { foo() } + } + "#); assert_that(foo.cargo_process("build").env("SRC", &lib).arg("-v"), execs().with_status(0));