Skip to content

Commit 97e7252

Browse files
committed
Auto merge of rust-lang#128863 - matthiaskrgr:rollup-wmp8znk, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#128616 (Don't inline tainted MIR bodies) - rust-lang#128804 (run-make: enable msvc for redundant-libs) - rust-lang#128823 (run-make: enable msvc for staticlib-dylib-linkage) - rust-lang#128824 (Update compiler-builtins version to 0.1.118) Failed merges: - rust-lang#128410 (Migrate `remap-path-prefix-dwarf` `run-make` test to rmake) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fac7753 + e880679 commit 97e7252

File tree

11 files changed

+64
-27
lines changed

11 files changed

+64
-27
lines changed

compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies = [
5050

5151
[[package]]
5252
name = "compiler_builtins"
53-
version = "0.1.109"
53+
version = "0.1.118"
5454
source = "registry+https://github.com/rust-lang/crates.io-index"
5555
checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e"
5656
dependencies = [

compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
# TODO: after the sync, revert to using version 0.1.
10-
# compiler_builtins = "0.1"
11-
compiler_builtins = "=0.1.109"
9+
compiler_builtins = "0.1"
1210
alloc = { path = "./sysroot_src/library/alloc" }
1311
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1412
test = { path = "./sysroot_src/library/test" }

compiler/rustc_mir_transform/src/inline.rs

+4
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ impl<'tcx> Inliner<'tcx> {
505505
) -> Result<(), &'static str> {
506506
let tcx = self.tcx;
507507

508+
if let Some(_) = callee_body.tainted_by_errors {
509+
return Err("Body is tainted");
510+
}
511+
508512
let mut threshold = if self.caller_is_inline_forwarder {
509513
self.tcx.sess.opts.unstable_opts.inline_mir_forwarder_threshold.unwrap_or(30)
510514
} else if cross_crate_inlinable {

library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ dependencies = [
5858

5959
[[package]]
6060
name = "compiler_builtins"
61-
version = "0.1.117"
61+
version = "0.1.118"
6262
source = "registry+https://github.com/rust-lang/crates.io-index"
63-
checksum = "a91dae36d82fe12621dfb5b596d7db766187747749b22e33ac068e1bfc356f4a"
63+
checksum = "92afe7344b64cccf3662ca26d5d1c0828ab826f04206b97d856e3625e390e4b5"
6464
dependencies = [
6565
"cc",
6666
"rustc-std-workspace-core",

library/alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010

1111
[dependencies]
1212
core = { path = "../core" }
13-
compiler_builtins = { version = "0.1.117", features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { version = "0.1.118", features = ['rustc-dep-of-std'] }
1414

1515
[dev-dependencies]
1616
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1717
panic_unwind = { path = "../panic_unwind", optional = true }
1818
panic_abort = { path = "../panic_abort" }
1919
core = { path = "../core", public = true }
20-
compiler_builtins = { version = "0.1.117" }
20+
compiler_builtins = { version = "0.1.118" }
2121
profiler_builtins = { path = "../profiler_builtins", optional = true }
2222
unwind = { path = "../unwind" }
2323
hashbrown = { version = "0.14", default-features = false, features = [

tests/run-make/redundant-libs/foo.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
void foo1() {}
2-
void foo2() {}
1+
#ifdef _MSC_VER
2+
#define DllExport __declspec(dllexport)
3+
#else
4+
#define DllExport
5+
#endif
6+
7+
DllExport void foo1() {}
8+
DllExport void foo2() {}

tests/run-make/redundant-libs/rmake.rs

-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010

1111
//@ ignore-cross-compile
1212
// Reason: the compiled binary is executed
13-
//@ ignore-windows-msvc
14-
// Reason: this test links libraries via link.exe, which only accepts the import library
15-
// for the dynamic library, i.e. `foo.dll.lib`. However, build_native_dynamic_lib only
16-
// produces `foo.dll` - the dynamic library itself. To make this test work on MSVC, one
17-
// would need to derive the import library from the dynamic library.
18-
// See https://stackoverflow.com/questions/9360280/
1913

2014
use run_make_support::{
2115
build_native_dynamic_lib, build_native_static_lib, cwd, is_msvc, rfs, run, rustc,

tests/run-make/staticlib-dylib-linkage/rmake.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88
// Reason: the compiled binary is executed.
99
//@ ignore-wasm
1010
// Reason: WASM does not support dynamic libraries
11-
//@ ignore-msvc
12-
//FIXME(Oneirical): Getting this to work on MSVC requires passing libcmt.lib to CC,
13-
// which is not trivial to do.
14-
// Tracking issue: https://github.com/rust-lang/rust/issues/128602
15-
// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172
1611

17-
use run_make_support::{cc, regex, run, rustc};
12+
use run_make_support::{cc, is_msvc, regex, run, rustc, static_lib_name};
1813

1914
fn main() {
2015
rustc().arg("-Cprefer-dynamic").input("bar.rs").run();
@@ -29,9 +24,13 @@ fn main() {
2924
let re = regex::Regex::new(r#"note: native-static-libs:\s*(.+)"#).unwrap();
3025
let libs = re.find(&libs).unwrap().as_str().trim();
3126
// remove the note
32-
let (_, library_search_paths) = libs.split_once("note: native-static-libs: ").unwrap();
27+
let (_, native_link_args) = libs.split_once("note: native-static-libs: ").unwrap();
3328
// divide the command-line arguments in a vec
34-
let library_search_paths = library_search_paths.split(' ').collect::<Vec<&str>>();
35-
cc().input("foo.c").arg("-lfoo").args(library_search_paths).out_exe("foo").run();
29+
let mut native_link_args = native_link_args.split(' ').collect::<Vec<&str>>();
30+
if is_msvc() {
31+
// For MSVC pass the arguments on to the linker.
32+
native_link_args.insert(0, "-link");
33+
}
34+
cc().input("foo.c").input(static_lib_name("foo")).args(native_link_args).out_exe("foo").run();
3635
run("foo");
3736
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
2-
//@ known-bug: #122909
32

3+
#![feature(unboxed_closures)]
44

5-
use std::sync::{Arc, Context, Weak};
5+
use std::sync::Arc;
66

77
pub struct WeakOnce<T>();
8+
//~^ ERROR type parameter `T` is never used
9+
810
impl<T> WeakOnce<T> {
911
extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
12+
//~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
13+
//~| ERROR mismatched types
1014

1115
pub fn get(&self) -> Arc<T> {
1216
self.try_get()
1317
.unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
1418
}
1519
}
20+
21+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0392]: type parameter `T` is never used
2+
--> $DIR/inline-tainted-body.rs:7:21
3+
|
4+
LL | pub struct WeakOnce<T>();
5+
| ^ unused type parameter
6+
|
7+
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
8+
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
9+
10+
error: functions with the "rust-call" ABI must take a single non-self tuple argument
11+
--> $DIR/inline-tainted-body.rs:11:35
12+
|
13+
LL | extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
14+
| ^^^^^
15+
16+
error[E0308]: mismatched types
17+
--> $DIR/inline-tainted-body.rs:11:45
18+
|
19+
LL | extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
20+
| ------- ^^^^^^^^^^^^^^ expected `Option<Arc<T>>`, found `()`
21+
| |
22+
| implicitly returns `()` as its body has no tail or `return` expression
23+
|
24+
= note: expected enum `Option<Arc<T>>`
25+
found unit type `()`
26+
27+
error: aborting due to 3 previous errors
28+
29+
Some errors have detailed explanations: E0308, E0392.
30+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)