about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock2
-rw-r--r--compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml4
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs4
-rw-r--r--library/Cargo.lock4
-rw-r--r--library/alloc/Cargo.toml2
-rw-r--r--library/std/Cargo.toml2
-rw-r--r--tests/run-make/redundant-libs/foo.c10
-rw-r--r--tests/run-make/redundant-libs/rmake.rs6
-rw-r--r--tests/run-make/staticlib-dylib-linkage/rmake.rs17
-rw-r--r--tests/ui/polymorphization/inline-tainted-body.rs (renamed from tests/crashes/122909.rs)10
-rw-r--r--tests/ui/polymorphization/inline-tainted-body.stderr30
11 files changed, 64 insertions, 27 deletions
diff --git a/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock b/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock
index d6ec1f87d01..771f2f18dce 100644
--- a/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock
+++ b/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock
@@ -50,7 +50,7 @@ dependencies = [
 
 [[package]]
 name = "compiler_builtins"
-version = "0.1.109"
+version = "0.1.118"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e"
 dependencies = [
diff --git a/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml b/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml
index e4669923623..05503128f2a 100644
--- a/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml
+++ b/compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml
@@ -6,9 +6,7 @@ resolver = "2"
 
 [dependencies]
 core = { path = "./sysroot_src/library/core" }
-# TODO: after the sync, revert to using version 0.1.
-# compiler_builtins = "0.1"
-compiler_builtins = "=0.1.109"
+compiler_builtins = "0.1"
 alloc = { path = "./sysroot_src/library/alloc" }
 std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
 test = { path = "./sysroot_src/library/test" }
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 0f012242c37..324ddc5e799 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -505,6 +505,10 @@ impl<'tcx> Inliner<'tcx> {
     ) -> Result<(), &'static str> {
         let tcx = self.tcx;
 
+        if let Some(_) = callee_body.tainted_by_errors {
+            return Err("Body is tainted");
+        }
+
         let mut threshold = if self.caller_is_inline_forwarder {
             self.tcx.sess.opts.unstable_opts.inline_mir_forwarder_threshold.unwrap_or(30)
         } else if cross_crate_inlinable {
diff --git a/library/Cargo.lock b/library/Cargo.lock
index c5182516f7d..b36399d880e 100644
--- a/library/Cargo.lock
+++ b/library/Cargo.lock
@@ -58,9 +58,9 @@ dependencies = [
 
 [[package]]
 name = "compiler_builtins"
-version = "0.1.117"
+version = "0.1.118"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a91dae36d82fe12621dfb5b596d7db766187747749b22e33ac068e1bfc356f4a"
+checksum = "92afe7344b64cccf3662ca26d5d1c0828ab826f04206b97d856e3625e390e4b5"
 dependencies = [
  "cc",
  "rustc-std-workspace-core",
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
index 82d5893dc5e..bdf16257c7c 100644
--- a/library/alloc/Cargo.toml
+++ b/library/alloc/Cargo.toml
@@ -10,7 +10,7 @@ edition = "2021"
 
 [dependencies]
 core = { path = "../core" }
-compiler_builtins = { version = "0.1.117", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "0.1.118", features = ['rustc-dep-of-std'] }
 
 [dev-dependencies]
 rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 06e818fb7c0..2ce284c85e2 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -17,7 +17,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
 panic_unwind = { path = "../panic_unwind", optional = true }
 panic_abort = { path = "../panic_abort" }
 core = { path = "../core", public = true }
-compiler_builtins = { version = "0.1.117" }
+compiler_builtins = { version = "0.1.118" }
 profiler_builtins = { path = "../profiler_builtins", optional = true }
 unwind = { path = "../unwind" }
 hashbrown = { version = "0.14", default-features = false, features = [
diff --git a/tests/run-make/redundant-libs/foo.c b/tests/run-make/redundant-libs/foo.c
index 339ee86c99e..551b85d1824 100644
--- a/tests/run-make/redundant-libs/foo.c
+++ b/tests/run-make/redundant-libs/foo.c
@@ -1,2 +1,8 @@
-void foo1() {}
-void foo2() {}
+#ifdef _MSC_VER
+#define DllExport __declspec(dllexport)
+#else
+#define DllExport
+#endif
+
+DllExport void foo1() {}
+DllExport void foo2() {}
diff --git a/tests/run-make/redundant-libs/rmake.rs b/tests/run-make/redundant-libs/rmake.rs
index fb1b3bca8ad..43bb30bde70 100644
--- a/tests/run-make/redundant-libs/rmake.rs
+++ b/tests/run-make/redundant-libs/rmake.rs
@@ -10,12 +10,6 @@
 
 //@ ignore-cross-compile
 // Reason: the compiled binary is executed
-//@ ignore-windows-msvc
-// Reason: this test links libraries via link.exe, which only accepts the import library
-// for the dynamic library, i.e. `foo.dll.lib`. However, build_native_dynamic_lib only
-// produces `foo.dll` - the dynamic library itself. To make this test work on MSVC, one
-// would need to derive the import library from the dynamic library.
-// See https://stackoverflow.com/questions/9360280/
 
 use run_make_support::{
     build_native_dynamic_lib, build_native_static_lib, cwd, is_msvc, rfs, run, rustc,
diff --git a/tests/run-make/staticlib-dylib-linkage/rmake.rs b/tests/run-make/staticlib-dylib-linkage/rmake.rs
index 415491bb8ee..8dd1ac0ffbd 100644
--- a/tests/run-make/staticlib-dylib-linkage/rmake.rs
+++ b/tests/run-make/staticlib-dylib-linkage/rmake.rs
@@ -8,13 +8,8 @@
 // Reason: the compiled binary is executed.
 //@ ignore-wasm
 // Reason: WASM does not support dynamic libraries
-//@ ignore-msvc
-//FIXME(Oneirical): Getting this to work on MSVC requires passing libcmt.lib to CC,
-// which is not trivial to do.
-// Tracking issue: https://github.com/rust-lang/rust/issues/128602
-// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172
 
-use run_make_support::{cc, regex, run, rustc};
+use run_make_support::{cc, is_msvc, regex, run, rustc, static_lib_name};
 
 fn main() {
     rustc().arg("-Cprefer-dynamic").input("bar.rs").run();
@@ -29,9 +24,13 @@ fn main() {
     let re = regex::Regex::new(r#"note: native-static-libs:\s*(.+)"#).unwrap();
     let libs = re.find(&libs).unwrap().as_str().trim();
     // remove the note
-    let (_, library_search_paths) = libs.split_once("note: native-static-libs: ").unwrap();
+    let (_, native_link_args) = libs.split_once("note: native-static-libs: ").unwrap();
     // divide the command-line arguments in a vec
-    let library_search_paths = library_search_paths.split(' ').collect::<Vec<&str>>();
-    cc().input("foo.c").arg("-lfoo").args(library_search_paths).out_exe("foo").run();
+    let mut native_link_args = native_link_args.split(' ').collect::<Vec<&str>>();
+    if is_msvc() {
+        // For MSVC pass the arguments on to the linker.
+        native_link_args.insert(0, "-link");
+    }
+    cc().input("foo.c").input(static_lib_name("foo")).args(native_link_args).out_exe("foo").run();
     run("foo");
 }
diff --git a/tests/crashes/122909.rs b/tests/ui/polymorphization/inline-tainted-body.rs
index 9d17ed83ea9..13aec97e22b 100644
--- a/tests/crashes/122909.rs
+++ b/tests/ui/polymorphization/inline-tainted-body.rs
@@ -1,15 +1,21 @@
 //@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
-//@ known-bug: #122909
 
+#![feature(unboxed_closures)]
 
-use std::sync::{Arc, Context, Weak};
+use std::sync::Arc;
 
 pub struct WeakOnce<T>();
+//~^ ERROR type parameter `T` is never used
+
 impl<T> WeakOnce<T> {
     extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
+    //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
+    //~| ERROR mismatched types
 
     pub fn get(&self) -> Arc<T> {
         self.try_get()
             .unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
     }
 }
+
+fn main() {}
diff --git a/tests/ui/polymorphization/inline-tainted-body.stderr b/tests/ui/polymorphization/inline-tainted-body.stderr
new file mode 100644
index 00000000000..5c3bd70adae
--- /dev/null
+++ b/tests/ui/polymorphization/inline-tainted-body.stderr
@@ -0,0 +1,30 @@
+error[E0392]: type parameter `T` is never used
+  --> $DIR/inline-tainted-body.rs:7:21
+   |
+LL | pub struct WeakOnce<T>();
+   |                     ^ unused type parameter
+   |
+   = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
+   = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
+
+error: functions with the "rust-call" ABI must take a single non-self tuple argument
+  --> $DIR/inline-tainted-body.rs:11:35
+   |
+LL |     extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
+   |                                   ^^^^^
+
+error[E0308]: mismatched types
+  --> $DIR/inline-tainted-body.rs:11:45
+   |
+LL |     extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
+   |                           -------           ^^^^^^^^^^^^^^ expected `Option<Arc<T>>`, found `()`
+   |                           |
+   |                           implicitly returns `()` as its body has no tail or `return` expression
+   |
+   = note:   expected enum `Option<Arc<T>>`
+           found unit type `()`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0308, E0392.
+For more information about an error, try `rustc --explain E0308`.