Update to 1.78.0

This commit is contained in:
Josh Stone 2024-05-02 10:01:52 -07:00
parent 3334ed315d
commit 110b2ab26e
20 changed files with 755 additions and 407 deletions

1
.gitignore vendored
View File

@ -434,3 +434,4 @@
/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz
/rustc-1.77.0-src.tar.xz
/rustc-1.77.2-src.tar.xz
/rustc-1.78.0-src.tar.xz

View File

@ -0,0 +1,59 @@
From 6dda4e006b0d6d7519ac4a9f540566c81e406a8b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 22 Apr 2024 16:19:17 -0700
Subject: [PATCH] Fix 2 tests for offline execution
In `alt_registry::warn_for_unused_fields`, the second part of the test
runs on `--registry crates-io`, so it needs a local replacement url.
In `install::install_global_cargo_config`, it was adding to the "config"
file, but the `pkg` before it configured the dummy registry replacement
in "config.toml". So that replacement wasn't actually used, and if you
ran tests online it was trying to install `bar v0.1.1` from the real
registry! The filename is now fixed, and the test double-checks that
we're only trying to install the local `bar v0.0.1`.
---
tests/testsuite/alt_registry.rs | 4 ++++
tests/testsuite/install.rs | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs
index e95f2cbaabbd..1fef04e3ae42 100644
--- a/tests/testsuite/alt_registry.rs
+++ b/tests/testsuite/alt_registry.rs
@@ -1572,7 +1572,11 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN",
)
.run();
+ let crates_io = registry::RegistryBuilder::new()
+ .no_configure_token()
+ .build();
p.cargo("publish --registry crates-io")
+ .replace_crates_io(crates_io.index_url())
.with_status(101)
.with_stderr(
"\
diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs
index 89d40ada9543..ef3f4f3ae604 100644
--- a/tests/testsuite/install.rs
+++ b/tests/testsuite/install.rs
@@ -1981,7 +1981,7 @@ fn install_ignores_unstable_table_in_local_cargo_config() {
fn install_global_cargo_config() {
pkg("bar", "0.0.1");
- let config = cargo_home().join("config");
+ let config = cargo_home().join("config.toml");
let mut toml = fs::read_to_string(&config).unwrap_or_default();
toml.push_str(
@@ -1994,6 +1994,7 @@ fn install_global_cargo_config() {
cargo_process("install bar")
.with_status(101)
+ .with_stderr_contains("[INSTALLING] bar v0.0.1")
.with_stderr_contains("[..]--target nonexistent[..]")
.run();
}
--
2.44.0

View File

@ -1,4 +1,4 @@
From fb4d9ee194e4e6488dcbf9a7e4e16bb1e65ce5f2 Mon Sep 17 00:00:00 2001
From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 8 Apr 2024 15:04:44 -0700
Subject: [PATCH] Fix UI tests with dist-vendored dependencies
@ -11,18 +11,16 @@ directory, which distro builds often use, so now we ignore that too.
Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably
expecting a version suffix, but the vendored path doesn't include the
version. Now that matches `[\\/]hashbrown` instead.
(cherry picked from commit f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63)
---
src/tools/compiletest/src/runtest.rs | 5 +++++
tests/ui/issues/issue-21763.rs | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 8be4def15ded..644775c0385c 100644
index bb8509fe4137..770496289e2e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2362,6 +2362,11 @@ fn make_compile_args(
@@ -2354,6 +2354,11 @@ fn make_compile_args(
"ignore-directory-in-diagnostics-source-blocks={}",
home::cargo_home().expect("failed to find cargo home").to_str().unwrap()
));
@ -35,14 +33,14 @@ index 8be4def15ded..644775c0385c 100644
// Optionally prevent default --sysroot if specified in test compile-flags.
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs
index 38103ff4f9c8..cc1a00687b30 100644
index a349253063c0..1d0a0705cbbd 100644
--- a/tests/ui/issues/issue-21763.rs
+++ b/tests/ui/issues/issue-21763.rs
@@ -1,6 +1,6 @@
// Regression test for HashMap only impl'ing Send/Sync if its contents do
-// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION"
+// normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION"
-//@ normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION"
+//@ normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION"
use std::collections::HashMap;
use std::rc::Rc;

View File

@ -0,0 +1,79 @@
From 27593a7ad3796cf3afaf4145275ff20d5aff333f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 10 Apr 2024 17:25:10 -0700
Subject: [PATCH 1/2] Set the host library path in run-make v2
When the build is configured with `[rust] rpath = false`, we need to set
`LD_LIBRARY_PATH` (or equivalent) to what would have been the `RPATH`,
so the compiler can find its own libraries. The old `tools.mk` code has
this environment prefixed in the `$(BARE_RUSTC)` variable, so we just
need to wire up something similar for run-make v2.
This is now set while building each `rmake.rs` itself, as well as in the
`rust-make-support` helpers for `rustc` and `rustdoc` commands. This is
also available in a `set_host_rpath` function for manual commands, like
in the `compiler-builtins` test.
(cherry picked from commit 8a5409bbdbadb522f25e7e5e3d54b967cb5eee56)
---
src/tools/compiletest/src/runtest.rs | 6 ++++++
src/tools/run-make-support/src/lib.rs | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 7be0571b1111..3c775ea0651c 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3767,6 +3767,11 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps);
debug!(?support_lib_deps_deps);
+ let mut host_dylib_env_paths = String::new();
+ host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy());
+ host_dylib_env_paths.push(':');
+ host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
+
let res = self.cmd2procres(
Command::new(&self.config.rustc_path)
.arg("-o")
@@ -3787,6 +3792,7 @@ fn run_rmake_v2_test(&self) {
.env("RUSTC", cwd.join(&self.config.rustc_path))
.env("TMPDIR", &tmpdir)
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
+ .env(dylib_env_var(), &host_dylib_env_paths)
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
.env("LLVM_COMPONENTS", &self.config.llvm_components)
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 674860f8413b..da3efd292b3f 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -11,6 +11,7 @@ pub fn out_dir() -> PathBuf {
fn setup_common_build_cmd() -> Command {
let rustc = env::var("RUSTC").unwrap();
let mut cmd = Command::new(rustc);
+ set_host_rpath(&mut cmd);
cmd.arg("--out-dir").arg(out_dir()).arg("-L").arg(out_dir());
cmd
}
@@ -157,3 +158,17 @@ pub fn run_fail(bin_name: &str) -> Output {
}
output
}
+
+/// Set the runtime library path as needed for running the host rustc/rustdoc/etc.
+pub fn set_host_rpath(cmd: &mut Command) {
+ let ld_lib_path_envvar = env::var("LD_LIB_PATH_ENVVAR").unwrap();
+ cmd.env(&ld_lib_path_envvar, {
+ let mut paths = vec![];
+ paths.push(PathBuf::from(env::var("TMPDIR").unwrap()));
+ paths.push(PathBuf::from(env::var("HOST_RPATH_DIR").unwrap()));
+ for p in env::split_paths(&env::var(&ld_lib_path_envvar).unwrap()) {
+ paths.push(p.to_path_buf());
+ }
+ env::join_paths(paths.iter()).unwrap()
+ });
+}
--
2.44.0

View File

@ -1,9 +1,8 @@
From 29ed7749a3a0e4399b91b3d4198891a4d861f105 Mon Sep 17 00:00:00 2001
From 245fbeef49c2395471498d20e67f4edf4222c865 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
Date: Tue, 16 Apr 2024 16:45:59 -0700
Subject: [PATCH] The `multiple_unsafe_ops_per_block` test needs `asm!`
(cherry picked from commit 245fbeef49c2395471498d20e67f4edf4222c865)
---
tests/ui/multiple_unsafe_ops_per_block.rs | 1 +
tests/ui/multiple_unsafe_ops_per_block.stderr | 58 +++++++++----------
@ -19,13 +18,13 @@ index 8afb4df20af4..6b8a103d4a94 100644
#![allow(unused)]
#![allow(deref_nullptr)]
diff --git a/tests/ui/multiple_unsafe_ops_per_block.stderr b/tests/ui/multiple_unsafe_ops_per_block.stderr
index 4803a5089ab2..f9b22c68ddb1 100644
index cff85ae115e0..e732bde0707e 100644
--- a/tests/ui/multiple_unsafe_ops_per_block.stderr
+++ b/tests/ui/multiple_unsafe_ops_per_block.stderr
@@ -1,5 +1,5 @@
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:36:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:37:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:36:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:37:5
|
LL | / unsafe {
LL | | STATIC += 1;
@ -33,14 +32,14 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: modification of a mutable static occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:37:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:38:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:37:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:38:9
|
LL | STATIC += 1;
| ^^^^^^^^^^^
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:38:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:39:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:38:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:39:9
|
LL | not_very_safe();
| ^^^^^^^^^^^^^^^
@ -48,8 +47,8 @@ index 4803a5089ab2..f9b22c68ddb1 100644
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:45:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:46:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:45:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:46:5
|
LL | / unsafe {
LL | | drop(u.u);
@ -57,21 +56,21 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: union field access occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:46:14
+ --> $DIR/multiple_unsafe_ops_per_block.rs:47:14
- --> tests/ui/multiple_unsafe_ops_per_block.rs:46:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:47:14
|
LL | drop(u.u);
| ^^^
note: raw pointer dereference occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:47:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:48:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:47:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:48:9
|
LL | *raw_ptr();
| ^^^^^^^^^^
error: this `unsafe` block contains 3 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:52:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:53:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:52:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:53:5
|
LL | / unsafe {
LL | | asm!("nop");
@ -79,27 +78,27 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: inline assembly used here
- --> $DIR/multiple_unsafe_ops_per_block.rs:53:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:54:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:53:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
|
LL | asm!("nop");
| ^^^^^^^^^^^
note: unsafe method call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:54:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:55:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
|
LL | sample.not_very_safe();
| ^^^^^^^^^^^^^^^^^^^^^^
note: modification of a mutable static occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:55:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:56:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:56:9
|
LL | STATIC = 0;
| ^^^^^^^^^^
error: this `unsafe` block contains 6 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:61:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:62:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:61:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:62:5
|
LL | / unsafe {
LL | | drop(u.u);
@ -107,65 +106,65 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: union field access occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:62:14
+ --> $DIR/multiple_unsafe_ops_per_block.rs:63:14
- --> tests/ui/multiple_unsafe_ops_per_block.rs:62:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:63:14
|
LL | drop(u.u);
| ^^^
note: access of a mutable static occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:63:14
+ --> $DIR/multiple_unsafe_ops_per_block.rs:64:14
- --> tests/ui/multiple_unsafe_ops_per_block.rs:63:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:64:14
|
LL | drop(STATIC);
| ^^^^^^
note: unsafe method call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:64:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:65:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:64:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:65:9
|
LL | sample.not_very_safe();
| ^^^^^^^^^^^^^^^^^^^^^^
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:65:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:66:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:65:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
|
LL | not_very_safe();
| ^^^^^^^^^^^^^^^
note: raw pointer dereference occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:66:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:67:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
|
LL | *raw_ptr();
| ^^^^^^^^^^
note: inline assembly used here
- --> $DIR/multiple_unsafe_ops_per_block.rs:67:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:68:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:68:9
|
LL | asm!("nop");
| ^^^^^^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:5
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:14
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:14
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:14
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: raw pointer dereference occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:105:39
+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:39
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:39
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:39
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:123:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:124:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:123:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:124:5
|
LL | / unsafe {
LL | | x();
@ -173,21 +172,21 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:124:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:125:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:124:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:125:9
|
LL | x();
| ^^^
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:125:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:126:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:125:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:126:9
|
LL | x();
| ^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:134:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:135:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:134:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:135:9
|
LL | / unsafe {
LL | | T::X();
@ -195,21 +194,21 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_________^
|
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:135:13
+ --> $DIR/multiple_unsafe_ops_per_block.rs:136:13
- --> tests/ui/multiple_unsafe_ops_per_block.rs:135:13
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:136:13
|
LL | T::X();
| ^^^^^^
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:136:13
+ --> $DIR/multiple_unsafe_ops_per_block.rs:137:13
- --> tests/ui/multiple_unsafe_ops_per_block.rs:136:13
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:137:13
|
LL | T::X();
| ^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> $DIR/multiple_unsafe_ops_per_block.rs:144:5
+ --> $DIR/multiple_unsafe_ops_per_block.rs:145:5
- --> tests/ui/multiple_unsafe_ops_per_block.rs:144:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:145:5
|
LL | / unsafe {
LL | | x.0();
@ -217,14 +216,14 @@ index 4803a5089ab2..f9b22c68ddb1 100644
| |_____^
|
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:145:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:146:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:145:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:146:9
|
LL | x.0();
| ^^^^^
note: unsafe function call occurs here
- --> $DIR/multiple_unsafe_ops_per_block.rs:146:9
+ --> $DIR/multiple_unsafe_ops_per_block.rs:147:9
- --> tests/ui/multiple_unsafe_ops_per_block.rs:146:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:147:9
|
LL | x.0();
| ^^^^^

View File

@ -0,0 +1,264 @@
From 706f06c39a9e08a4708a53722429d13ae4069c2f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 1 May 2024 15:25:26 -0700
Subject: [PATCH] Use an explicit x86-64 cpu in tests that are sensitive to it
There are a few tests that depend on some target features **not** being
enabled by default, and usually they are correct with the default x86-64
target CPU. However, in downstream builds we have modified the default
to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10
-- and the latter especially trips tests that expect not to have AVX.
These cases are few enough that we can just set them back explicitly.
---
tests/assembly/simd-intrinsic-mask-reduce.rs | 1 +
tests/assembly/x86_64-floating-point-clamp.rs | 2 +-
.../codegen/target-feature-inline-closure.rs | 2 +-
tests/ui/asm/x86_64/target-feature-attr.rs | 1 +
.../ui/asm/x86_64/target-feature-attr.stderr | 8 +++---
.../const-eval/const_fn_target_feature.rs | 2 +-
.../rfc-2396-target_feature-11/safe-calls.rs | 1 +
.../safe-calls.stderr | 28 +++++++++----------
tests/ui/sse2.rs | 4 +--
9 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs
index 763401755fad..0d77fc410511 100644
--- a/tests/assembly/simd-intrinsic-mask-reduce.rs
+++ b/tests/assembly/simd-intrinsic-mask-reduce.rs
@@ -1,6 +1,7 @@
// verify that simd mask reductions do not introduce additional bit shift operations
//@ revisions: x86 aarch64
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
+//@ [x86] compile-flags: -C target-cpu=x86-64
//@ [x86] needs-llvm-components: x86
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
//@ [aarch64] needs-llvm-components: aarch64
diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs
index 4a72a7f44fa0..b963aee35590 100644
--- a/tests/assembly/x86_64-floating-point-clamp.rs
+++ b/tests/assembly/x86_64-floating-point-clamp.rs
@@ -2,7 +2,7 @@
// so check to make sure that's what it's actually emitting.
//@ assembly-output: emit-asm
-//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
+//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64
//@ only-x86_64
//@ ignore-sgx
diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs
index 88bd413a8707..20bb4e66ff21 100644
--- a/tests/codegen/target-feature-inline-closure.rs
+++ b/tests/codegen/target-feature-inline-closure.rs
@@ -1,5 +1,5 @@
//@ only-x86_64
-//@ compile-flags: -Copt-level=3
+//@ compile-flags: -Copt-level=3 -Ctarget-cpu=x86-64
#![crate_type = "lib"]
#![feature(target_feature_11)]
diff --git a/tests/ui/asm/x86_64/target-feature-attr.rs b/tests/ui/asm/x86_64/target-feature-attr.rs
index 820be132ef79..51829be15065 100644
--- a/tests/ui/asm/x86_64/target-feature-attr.rs
+++ b/tests/ui/asm/x86_64/target-feature-attr.rs
@@ -1,4 +1,5 @@
//@ only-x86_64
+//@ compile-flags: -C target-cpu=x86-64
#![feature(avx512_target_feature)]
diff --git a/tests/ui/asm/x86_64/target-feature-attr.stderr b/tests/ui/asm/x86_64/target-feature-attr.stderr
index c852726ee7ff..1a9962732cfb 100644
--- a/tests/ui/asm/x86_64/target-feature-attr.stderr
+++ b/tests/ui/asm/x86_64/target-feature-attr.stderr
@@ -1,23 +1,23 @@
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:40
+ --> $DIR/target-feature-attr.rs:19:40
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:55
+ --> $DIR/target-feature-attr.rs:19:55
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:70
+ --> $DIR/target-feature-attr.rs:19:70
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^^^^^^
error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f
- --> $DIR/target-feature-attr.rs:33:23
+ --> $DIR/target-feature-attr.rs:34:23
|
LL | asm!("/* {0} */", in(kreg) x);
| ^^^^^^^^^^
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.rs b/tests/ui/consts/const-eval/const_fn_target_feature.rs
index b56b68a57958..d0de9d8d7a34 100644
--- a/tests/ui/consts/const-eval/const_fn_target_feature.rs
+++ b/tests/ui/consts/const-eval/const_fn_target_feature.rs
@@ -1,5 +1,5 @@
//@ only-x86_64
-//@ compile-flags:-C target-feature=+ssse3
+//@ compile-flags: -C target-cpu=x86-64 -C target-feature=+ssse3
#![crate_type = "lib"]
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
index c73b8d7e4d29..6fb0688008e6 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
@@ -1,4 +1,5 @@
//@ only-x86_64
+//@ compile-flags: -C target-cpu=x86-64
#![feature(target_feature_11)]
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
index d9d7e297f8e9..fed3da6594cb 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
@@ -1,5 +1,5 @@
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:25:5
+ --> $DIR/safe-calls.rs:26:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -8,7 +8,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:27:5
+ --> $DIR/safe-calls.rs:28:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -16,7 +16,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:29:5
+ --> $DIR/safe-calls.rs:30:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -24,7 +24,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:35:5
+ --> $DIR/safe-calls.rs:36:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -32,7 +32,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:37:5
+ --> $DIR/safe-calls.rs:38:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -40,7 +40,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:43:5
+ --> $DIR/safe-calls.rs:44:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -49,7 +49,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:45:5
+ --> $DIR/safe-calls.rs:46:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -57,7 +57,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:47:5
+ --> $DIR/safe-calls.rs:48:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -65,7 +65,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:54:5
+ --> $DIR/safe-calls.rs:55:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -74,7 +74,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:58:15
+ --> $DIR/safe-calls.rs:59:15
|
LL | const _: () = sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -83,7 +83,7 @@ LL | const _: () = sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:61:15
+ --> $DIR/safe-calls.rs:62:15
|
LL | const _: () = sse2_and_fxsr();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -92,7 +92,7 @@ LL | const _: () = sse2_and_fxsr();
= note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
- --> $DIR/safe-calls.rs:68:5
+ --> $DIR/safe-calls.rs:69:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -101,12 +101,12 @@ LL | sse2();
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/safe-calls.rs:67:1
+ --> $DIR/safe-calls.rs:68:1
|
LL | unsafe fn needs_unsafe_block() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
- --> $DIR/safe-calls.rs:64:8
+ --> $DIR/safe-calls.rs:65:8
|
LL | #[deny(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/sse2.rs b/tests/ui/sse2.rs
index fa6d79713b4b..c203ca2716ff 100644
--- a/tests/ui/sse2.rs
+++ b/tests/ui/sse2.rs
@@ -20,6 +20,6 @@ fn main() {
"SSE2 was not detected as available on an x86 platform");
}
// check a negative case too -- allowed on x86, but not enabled by default
- assert!(cfg!(not(target_feature = "avx2")),
- "AVX2 shouldn't be detected as available by default on any platform");
+ assert!(cfg!(not(target_feature = "avx512f")),
+ "AVX512 shouldn't be detected as available by default on any platform");
}
--
2.44.0

View File

@ -1,4 +1,4 @@
From df0d6f1d8b46db82d7599ca8eff6e8f844cf52f2 Mon Sep 17 00:00:00 2001
From 2b99134e2884fa56bcab6d360885ec5421048e66 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,12 +11,12 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index e5df28a49af6..2fcd8b8cb057 100644
index f94553dd63f7..5ec969c80a37 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -807,6 +807,11 @@ change-id = 116881
# target triples containing `-none`, `nvptx`, `switch`, or `-uefi`.
#no-std = <platform-specific> (bool)
@@ -869,6 +869,11 @@
# argument as the test binary.
#runner = <none> (string)
+# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
@ -27,10 +27,10 @@ index e5df28a49af6..2fcd8b8cb057 100644
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 7021a9543582..11555c65ca87 100644
index e927b491c71e..69a80d01d6b9 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -302,6 +302,10 @@ fn copy_self_contained_objects(
@@ -356,6 +356,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -42,18 +42,18 @@ index 7021a9543582..11555c65ca87 100644
t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![];
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 0a9175aa3ea5..a2e028b25036 100644
index 3e1bc9a9acdd..5e24a9cc4f60 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -533,6 +533,7 @@ pub struct Target {
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
@@ -586,6 +586,7 @@ pub struct Target {
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
+ pub self_contained: bool,
}
impl Target {
@@ -541,6 +542,9 @@ pub fn from_triple(triple: &str) -> Self {
@@ -594,6 +595,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
}
@ -63,15 +63,15 @@ index 0a9175aa3ea5..a2e028b25036 100644
target
}
}
@@ -1051,6 +1055,7 @@ struct TomlTarget {
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
@@ -1150,6 +1154,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -1600,6 +1605,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
@@ -1870,6 +1875,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
@ -82,10 +82,10 @@ index 0a9175aa3ea5..a2e028b25036 100644
target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 33b8f1a7ce72..f36e53187576 100644
index 5ed6b357e20a..c23b21d65713 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1335,6 +1335,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1348,6 +1348,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}
@ -98,5 +98,5 @@ index 33b8f1a7ce72..f36e53187576 100644
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool {
--
2.41.0
2.44.0

View File

@ -1,4 +1,4 @@
From 56942ed6d13d330facddbd71470a3c115a3fe0d1 Mon Sep 17 00:00:00 2001
From e8fb8c36ca0de817b3d30f603d6d6b3c56e8b0be Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 5 Apr 2024 15:07:58 -0700
Subject: [PATCH] bootstrap: move all of rustc's flags to `rustc_cargo`
@ -7,8 +7,6 @@ This ensures that `RUSTFLAGS` will be consistent between all modes of
building the compiler, so they won't trigger a rebuild by cargo. This
kind of fix was started in #119414 just for LTO flags, but it's
applicable to all kinds of flags that might be configured.
(cherry picked from commit e8fb8c36ca0de817b3d30f603d6d6b3c56e8b0be)
---
src/bootstrap/src/core/build_steps/check.rs | 2 +-
src/bootstrap/src/core/build_steps/compile.rs | 107 +++++++++---------
@ -17,26 +15,26 @@ applicable to all kinds of flags that might be configured.
4 files changed, 59 insertions(+), 54 deletions(-)
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index 5f0afdb1b36c..dd866c2eb0f3 100644
index 55180a82885b..37d91b14ca1b 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -263,7 +263,7 @@ fn run(self, builder: &Builder<'_>) {
target,
@@ -296,7 +296,7 @@ fn run(self, builder: &Builder<'_>) {
cargo_subcommand(builder.kind),
);
- rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ rustc_cargo(builder, &mut cargo, target, &compiler);
// For ./x.py clippy, don't run with --all-targets because
// linting tests and benchmarks can produce very noisy results
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index ddbe18ab8388..607a658617b5 100644
index e03997181ee5..9420e40d6c2b 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -898,55 +898,10 @@ fn run(self, builder: &Builder<'_>) -> u32 {
));
@@ -945,55 +945,10 @@ fn run(self, builder: &Builder<'_>) -> u32 {
"build",
);
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "build");
- rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ rustc_cargo(builder, &mut cargo, target, &compiler);
@ -92,7 +90,7 @@ index ddbe18ab8388..607a658617b5 100644
for krate in &*self.crates {
cargo.arg("-p").arg(krate);
@@ -997,7 +952,12 @@ fn run(self, builder: &Builder<'_>) -> u32 {
@@ -1044,7 +999,12 @@ fn run(self, builder: &Builder<'_>) -> u32 {
}
}
@ -105,8 +103,8 @@ index ddbe18ab8388..607a658617b5 100644
+) {
cargo
.arg("--features")
.arg(builder.rustc_features(builder.kind))
@@ -1008,7 +968,7 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
.arg(builder.rustc_features(builder.kind, target))
@@ -1055,7 +1015,7 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
// We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
// and may just be a time sink.
@ -115,7 +113,7 @@ index ddbe18ab8388..607a658617b5 100644
match builder.config.rust_lto {
RustcLto::Thin | RustcLto::Fat => {
// Since using LTO for optimizing dylibs is currently experimental,
@@ -1034,7 +994,52 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
@@ -1081,7 +1041,52 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
cargo.rustflag("-Clto=off");
}
@ -170,23 +168,23 @@ index ddbe18ab8388..607a658617b5 100644
pub fn rustc_cargo_env(
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 57e63927c95e..e10035f07c05 100644
index 51b5cdc05657..a22cbeacf016 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -794,7 +794,7 @@ fn run(self, builder: &Builder<'_>) {
cargo.rustdocflag("-Znormalize-docs");
cargo.rustdocflag("--show-type-layout");
cargo.rustdocflag("--generate-link-to-definition");
@@ -804,7 +804,7 @@ fn run(self, builder: &Builder<'_>) {
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
// cargo.rustdocflag("--generate-link-to-definition");
- compile::rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ compile::rustc_cargo(builder, &mut cargo, target, &compiler);
cargo.arg("-Zunstable-options");
cargo.arg("-Zskip-rustdoc-fingerprint");
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 04728e2e00dc..c4fdda0a2606 100644
index bacf5f0d33ce..5277c38a4ad0 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2558,7 +2558,7 @@ fn run(self, builder: &Builder<'_>) {
@@ -2671,7 +2671,7 @@ fn run(self, builder: &Builder<'_>) {
}
}
Mode::Rustc => {

View File

@ -0,0 +1,27 @@
From f25809d2d33e1141d73487e55fe155f41762aef3 Mon Sep 17 00:00:00 2001
From: onur-ozkan <work@onurozkan.dev>
Date: Sun, 10 Mar 2024 09:16:24 +0300
Subject: [PATCH] fix `long-linker-command-lines` failure caused by
`rust.rpath=false`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
---
tests/run-make/long-linker-command-lines/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile
index f864ea74f4a9..b573038e344a 100644
--- a/tests/run-make/long-linker-command-lines/Makefile
+++ b/tests/run-make/long-linker-command-lines/Makefile
@@ -1,6 +1,8 @@
# ignore-cross-compile
include ../tools.mk
+export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
+
all:
$(RUSTC) foo.rs -g -O
RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo)
--
2.44.0

View File

@ -1,82 +0,0 @@
From 96e7b2767b30c215361d26626ef235f5ec0e8cd5 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Fri, 16 Feb 2024 10:01:43 +0100
Subject: [PATCH] remove stderr-per-bitwidth from some tests
(cherry picked from commit f68e79dcac3acb635c58ff2fa4178b9a0b040fe4)
---
...ut_ref_in_final_dynamic_check.64bit.stderr | 20 -------------------
.../mut_ref_in_final_dynamic_check.rs | 3 ++-
... => mut_ref_in_final_dynamic_check.stderr} | 8 ++++----
3 files changed, 6 insertions(+), 25 deletions(-)
delete mode 100644 tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
rename tests/ui/consts/const-mut-refs/{mut_ref_in_final_dynamic_check.32bit.stderr => mut_ref_in_final_dynamic_check.stderr} (75%)
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
deleted file mode 100644
index fc68207512c0..000000000000
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mut_ref_in_final_dynamic_check.rs:15:1
- |
-LL | const A: Option<&mut i32> = helper();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- 2a 00 00 00 00 00 00 00 │ *.......
- }
-
-error: encountered dangling pointer in final value of constant
- --> $DIR/mut_ref_in_final_dynamic_check.rs:22:1
- |
-LL | const B: Option<&mut i32> = helper2();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
index 455b557b97c4..b98f4d920694 100644
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
@@ -1,4 +1,5 @@
-// stderr-per-bitwidth
+// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(const_mut_refs)]
#![feature(raw_ref_op)]
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
similarity index 75%
rename from tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
rename to tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
index 87420a037514..bb3c5518680b 100644
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
@@ -1,16 +1,16 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/mut_ref_in_final_dynamic_check.rs:15:1
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:16:1
|
LL | const A: Option<&mut i32> = helper();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- 2a 00 00 00 │ *...
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error: encountered dangling pointer in final value of constant
- --> $DIR/mut_ref_in_final_dynamic_check.rs:22:1
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:23:1
|
LL | const B: Option<&mut i32> = helper2();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
--
2.44.0

View File

@ -1,4 +1,4 @@
From ed8e223cc58103cae0586351fd9113a727523cab Mon Sep 17 00:00:00 2001
From a70f23c50b61c1a3335f2943375a04ae7abf2fa4 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 11 Apr 2024 14:58:42 -0700
Subject: [PATCH] test: don't compress test registry crates
@ -7,8 +7,6 @@ They are still nominally gzipped, but using `Compression::none()` makes
them consistent even across zlib and zlib-ng, and this fixes checksum
differences in the testsuite. There is a one-time update of all those
checksums to catch up with this change though.
(cherry picked from commit a70f23c50b61c1a3335f2943375a04ae7abf2fa4)
---
crates/cargo-test-support/src/registry.rs | 2 +-
tests/testsuite/alt_registry.rs | 2 +-
@ -20,7 +18,7 @@ checksums to catch up with this change though.
7 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs
index cc51707dbbf9..e27d1e354d7b 100644
index e65baeab17d7..f8b4b1447822 100644
--- a/crates/cargo-test-support/src/registry.rs
+++ b/crates/cargo-test-support/src/registry.rs
@@ -1469,7 +1469,7 @@ impl Package {
@ -33,10 +31,10 @@ index cc51707dbbf9..e27d1e354d7b 100644
if !self
.files
diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs
index f286dc018122..42b818493244 100644
index e122199baa41..fb88105374a2 100644
--- a/tests/testsuite/alt_registry.rs
+++ b/tests/testsuite/alt_registry.rs
@@ -1466,7 +1466,7 @@ dependencies = [
@@ -1493,7 +1493,7 @@ dependencies = [
name = "foo"
version = "0.1.0"
source = "sparse+http://[..]/"

View File

@ -0,0 +1,63 @@
From 642e12326055268c7605b31e7f91edf8f58e54d4 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 11 Apr 2024 15:33:44 -0700
Subject: [PATCH 2/2] Use `env::split_paths`/`join_paths` in runtest
(cherry picked from commit 7e171c72cbddb0636fa8ce71a0e862486ae72625)
---
src/tools/compiletest/src/runtest.rs | 31 ++++++++++++++--------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3c775ea0651c..852ffa0a62a8 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3767,10 +3767,13 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps);
debug!(?support_lib_deps_deps);
- let mut host_dylib_env_paths = String::new();
- host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy());
- host_dylib_env_paths.push(':');
- host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
+ let orig_dylib_env_paths =
+ Vec::from_iter(env::split_paths(&env::var(dylib_env_var()).unwrap()));
+
+ let mut host_dylib_env_paths = Vec::new();
+ host_dylib_env_paths.push(cwd.join(&self.config.compile_lib_path));
+ host_dylib_env_paths.extend(orig_dylib_env_paths.iter().cloned());
+ let host_dylib_env_paths = env::join_paths(host_dylib_env_paths).unwrap();
let res = self.cmd2procres(
Command::new(&self.config.rustc_path)
@@ -3810,19 +3813,15 @@ fn run_rmake_v2_test(&self) {
// Finally, we need to run the recipe binary to build and run the actual tests.
debug!(?recipe_bin);
- let mut dylib_env_paths = String::new();
- dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
- dylib_env_paths.push(':');
- dylib_env_paths.push_str(&support_lib_path.parent().unwrap().to_string_lossy());
- dylib_env_paths.push(':');
- dylib_env_paths.push_str(
- &stage_std_path.join("rustlib").join(&self.config.host).join("lib").to_string_lossy(),
- );
+ let mut dylib_env_paths = orig_dylib_env_paths.clone();
+ dylib_env_paths.push(support_lib_path.parent().unwrap().to_path_buf());
+ dylib_env_paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
+ let dylib_env_paths = env::join_paths(dylib_env_paths).unwrap();
- let mut target_rpath_env_path = String::new();
- target_rpath_env_path.push_str(&tmpdir.to_string_lossy());
- target_rpath_env_path.push(':');
- target_rpath_env_path.push_str(&dylib_env_paths);
+ let mut target_rpath_env_path = Vec::new();
+ target_rpath_env_path.push(&tmpdir);
+ target_rpath_env_path.extend(&orig_dylib_env_paths);
+ let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
let mut cmd = Command::new(&recipe_bin);
cmd.current_dir(&self.testpaths.file)
--
2.44.0

View File

@ -1,19 +1,19 @@
From 79bb610c8fc5d9df7dd4720ae847b8f17e7b1ad4 Mon Sep 17 00:00:00 2001
From e3b7d2e3d3b4fcbc6591de606957c0fd59b5e547 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
---
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++
compiler/rustc_target/src/spec/mod.rs | 2 ++
compiler/rustc_target/src/spec/targets/wasm32_wasi.rs | 6 +++++-
3 files changed, 16 insertions(+), 1 deletion(-)
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++
compiler/rustc_target/src/spec/mod.rs | 4 ++++
compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index dd9d277fb775..3d0f0502f255 100644
index f5e8d5fc92a9..f4ad3f725427 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1496,6 +1496,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1563,6 +1563,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -26,7 +26,7 @@ index dd9d277fb775..3d0f0502f255 100644
for search_path in fs.search_paths() {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -1982,6 +1988,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
@@ -2049,6 +2055,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}
@ -37,10 +37,10 @@ index dd9d277fb775..3d0f0502f255 100644
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index f04799482c83..25410b37ba24 100644
index 941d767b850d..cd0a2ce51989 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1874,6 +1874,7 @@ pub struct TargetOptions {
@@ -1881,6 +1881,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -48,7 +48,7 @@ index f04799482c83..25410b37ba24 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects,
@@ -2352,6 +2353,7 @@ fn default() -> TargetOptions {
@@ -2368,6 +2369,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
@ -56,23 +56,42 @@ index f04799482c83..25410b37ba24 100644
pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
index 6dbcb01ea436..2151f86d0648 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
@@ -86,7 +86,11 @@ pub fn target() -> Target {
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@@ -3064,6 +3066,7 @@ macro_rules! key {
key!(linker_is_gnu_json = "linker-is-gnu", bool);
key!(pre_link_objects = "pre-link-objects", link_objects);
key!(post_link_objects = "post-link-objects", link_objects);
+ key!(external_lib_path, optional);
key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects);
key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects);
// Deserializes the backwards-compatible variants of `-Clink-self-contained`
@@ -3327,6 +3330,7 @@ macro_rules! target_option_val {
target_option_val!(linker_is_gnu_json, "linker-is-gnu");
target_option_val!(pre_link_objects);
target_option_val!(post_link_objects);
+ target_option_val!(external_lib_path);
target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback");
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 7cbe9f09e6ca..b524890c2ec5 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -20,11 +20,12 @@ pub fn target() -> Target {
options.os = "wasi".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
- options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
+ options.pre_link_objects = crt_objects::pre_wasi_self_contained();
+ options.post_link_objects = crt_objects::post_wasi_self_contained();
// FIXME: Figure out cases in which WASM needs to link with a native toolchain.
- options.link_self_contained = LinkSelfContainedDefault::True;
+ options.link_self_contained = LinkSelfContainedDefault::False;
+
+ options.pre_link_objects = options.pre_link_objects_self_contained.clone();
+ options.post_link_objects = options.post_link_objects_self_contained.clone();
+ options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into());
// Right now this is a bit of a workaround but we're currently saying that
// the target by default has a static crt which we're taking as a signal
--
2.41.0
2.44.0

View File

@ -1,62 +0,0 @@
From 8eb48b4f4c6e3d48f2600159a75184ec4d74b249 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Wed, 31 Jan 2024 15:08:08 +0100
Subject: [PATCH] Update data layouts in custom target tests for LLVM 18
Fixes https://github.com/rust-lang/rust/issues/120492.
---
tests/run-make/rust-lld-custom-target/custom-target.json | 2 +-
tests/run-make/rustdoc-target-spec-json-path/target.json | 2 +-
tests/run-make/target-specs/my-awesome-platform.json | 2 +-
.../target-specs/my-x86_64-unknown-linux-gnu-platform.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/run-make/rust-lld-custom-target/custom-target.json b/tests/run-make/rust-lld-custom-target/custom-target.json
index 7828a99f235c1..e2c64cbdb43c2 100644
--- a/tests/run-make/rust-lld-custom-target/custom-target.json
+++ b/tests/run-make/rust-lld-custom-target/custom-target.json
@@ -2,7 +2,7 @@
"arch": "x86_64",
"cpu": "x86-64",
"crt-static-respected": true,
- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"dynamic-linking": true,
"env": "gnu",
"has-rpath": true,
diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json
index 34357182c205e..c478f1196fae0 100644
--- a/tests/run-make/rustdoc-target-spec-json-path/target.json
+++ b/tests/run-make/rustdoc-target-spec-json-path/target.json
@@ -2,7 +2,7 @@
"arch": "x86_64",
"cpu": "x86-64",
"crt-static-respected": true,
- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"dynamic-linking": true,
"env": "gnu",
"executables": true,
diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json
index 00de3de05f07a..1673ef7bd54d1 100644
--- a/tests/run-make/target-specs/my-awesome-platform.json
+++ b/tests/run-make/target-specs/my-awesome-platform.json
@@ -1,5 +1,5 @@
{
- "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
+ "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
"linker-flavor": "gcc",
"llvm-target": "i686-unknown-linux-gnu",
"target-endian": "little",
diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json
index 6d5e964ed4fee..0cafce15a9fef 100644
--- a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json
+++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json
@@ -1,6 +1,6 @@
{
"pre-link-args": {"gcc": ["-m64"]},
- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"llvm-target": "x86_64-unknown-linux-gnu",
"target-endian": "little",

View File

@ -1,55 +0,0 @@
From 369fff6c0640fe89be9b915adaa83e66a022e00d Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Wed, 14 Feb 2024 16:26:20 +0100
Subject: [PATCH] Implicitly enable evex512 if avx512 is enabled
LLVM 18 requires the evex512 feature to allow use of zmm registers.
LLVM automatically sets it when using a generic CPU, but not when
`-C target-cpu` is specified. This will result either in backend
legalization crashes, or code unexpectedly using ymm instead of
zmm registers.
For now, make sure that `avx512*` features imply `evex512`. Long
term we'll probably have to deal with the AVX10 mess somehow.
---
compiler/rustc_codegen_llvm/src/llvm_util.rs | 4 ++++
tests/ui/asm/x86_64/evex512-implicit-feature.rs | 15 +++++++++++++++
2 files changed, 19 insertions(+)
create mode 100644 tests/ui/asm/x86_64/evex512-implicit-feature.rs
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index e48479c8da279..54e8ed85e3250 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -266,6 +266,10 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> {
("riscv32" | "riscv64", "fast-unaligned-access") if get_version().0 <= 17 => {
LLVMFeature::new("unaligned-scalar-mem")
}
+ // For LLVM 18, enable the evex512 target feature if a avx512 target feature is enabled.
+ ("x86", s) if get_version().0 >= 18 && s.starts_with("avx512") => {
+ LLVMFeature::with_dependency(s, TargetFeatureFoldStrength::EnableOnly("evex512"))
+ }
(_, s) => LLVMFeature::new(s),
}
}
diff --git a/tests/ui/asm/x86_64/evex512-implicit-feature.rs b/tests/ui/asm/x86_64/evex512-implicit-feature.rs
new file mode 100644
index 0000000000000..a15060857eccb
--- /dev/null
+++ b/tests/ui/asm/x86_64/evex512-implicit-feature.rs
@@ -0,0 +1,15 @@
+// build-pass
+// only-x86_64
+// compile-flags: --crate-type=lib -C target-cpu=skylake
+
+#![feature(avx512_target_feature)]
+#![feature(stdsimd)]
+
+use std::arch::x86_64::*;
+
+#[target_feature(enable = "avx512f")]
+#[no_mangle]
+pub unsafe fn test(res: *mut f64, p: *const f64) {
+ let arg = _mm512_load_pd(p);
+ _mm512_store_pd(res, _mm512_fmaddsub_pd(arg, arg, arg));
+}

118
rust.spec
View File

@ -1,5 +1,5 @@
Name: rust
Version: 1.77.2
Version: 1.78.0
Release: %autorelease
Summary: The Rust Programming Language
License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-DFS-2016)
@ -14,9 +14,9 @@ ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.76.0
%global bootstrap_channel 1.76.0
%global bootstrap_date 2024-02-08
%global bootstrap_version 1.77.0
%global bootstrap_channel 1.77.0
%global bootstrap_date 2024-03-21
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -32,7 +32,9 @@ ExclusiveArch: %{rust_arches}
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
%global wasm_targets wasm32-unknown-unknown wasm32-wasi
# NB: wasm32-wasi is being gradually replaced by wasm32-wasip1
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
%global wasm_targets wasm32-unknown-unknown wasm32-wasi wasm32-wasip1
%if 0%{?fedora} || 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
@ -63,9 +65,9 @@ ExclusiveArch: %{rust_arches}
%bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 15.0+.
%global min_llvm_version 15.0.0
%global bundled_llvm_version 17.0.6
# is insufficient. Rust currently requires LLVM 16.0+.
%global min_llvm_version 16.0.0
%global bundled_llvm_version 18.1.2
#global llvm_compat_version 17
%global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm
@ -83,7 +85,7 @@ ExclusiveArch: %{rust_arches}
# Cargo uses UPSERTs with omitted conflict targets
%global min_sqlite3_version 3.35
%global bundled_sqlite3_version 3.44.0
%global bundled_sqlite3_version 3.45.0
%if 0%{?rhel} && 0%{?rhel} < 10
%bcond_without bundled_sqlite3
%else
@ -149,26 +151,32 @@ Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch
Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch
# We don't want to use the bundled library in libsqlite3-sys
Patch6: rustc-1.77.0-unbundle-sqlite.patch
# Backports of fixes for LLVM 18 compatibility
Patch7: 120529.patch
Patch8: 121088.patch
Patch6: rustc-1.78.0-unbundle-sqlite.patch
# https://github.com/rust-lang/rust/pull/123520
Patch9: 0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch
Patch7: 0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch
# https://github.com/rust-lang/rust/pull/123652
Patch10: 0001-Fix-UI-tests-with-dist-vendored-dependencies.patch
Patch8: 0001-Fix-UI-tests-with-dist-vendored-dependencies.patch
# https://github.com/rust-lang/rust/pull/121179 (partial)
Patch11: 0001-remove-stderr-per-bitwidth-from-some-tests.patch
# https://github.com/rust-lang/rust/pull/122270
Patch9: 0001-fix-long-linker-command-lines-failure-caused-by-rust.patch
# https://github.com/rust-lang/rust/pull/123763
Patch10: 0001-Set-the-host-library-path-in-run-make-v2.patch
Patch11: 0002-Use-env-split_paths-join_paths-in-runtest.patch
# https://github.com/rust-lang/rust/pull/124597
Patch12: 0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch
# https://github.com/rust-lang/cargo/pull/13744
Patch12: 0001-test-don-t-compress-test-registry-crates.patch
Patch20: 0001-test-don-t-compress-test-registry-crates.patch
# https://github.com/rust-lang/cargo/pull/13789
Patch21: 0001-Fix-2-tests-for-offline-execution.patch
# https://github.com/rust-lang/rust-clippy/pull/12682
Patch13: 0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch
Patch30: 0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch
### RHEL-specific patches below ###
@ -179,7 +187,7 @@ Source102: cargo_vendor.attr
Source103: cargo_vendor.prov
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.77.0-disable-libssh2.patch
Patch100: rustc-1.78.0-disable-libssh2.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
@ -436,6 +444,18 @@ BuildArch: noarch
%target_description wasm32-wasi WebAssembly
%endif
%if %target_enabled wasm32-wasip1
%target_package wasm32-wasip1
Requires: lld >= 8.0
%if %with bundled_wasi_libc
Provides: bundled(wasi-libc)
%else
Requires: wasi-libc-static
%endif
BuildArch: noarch
%target_description wasm32-wasip1 WebAssembly
%endif
%if %target_enabled x86_64-unknown-none
%target_package x86_64-unknown-none
Requires: lld
@ -647,8 +667,12 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%patch -P9 -p1
%patch -P10 -p1
%patch -P11 -p1
%patch -P12 -p1 -d src/tools/cargo
%patch -P13 -p1 -d src/tools/clippy
%patch -P12 -p1
%patch -P20 -p1 -d src/tools/cargo
%patch -P21 -p1 -d src/tools/cargo
%patch -P30 -p1 -d src/tools/clippy
%if %with disabled_libssh2
%patch -P100 -p1
@ -769,11 +793,16 @@ fi
%if %defined wasm_targets
%if %with bundled_wasi_libc
%make_build --quiet -C %{wasi_libc_dir} MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm
%define wasm_target_config --set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot
--set target.wasm32-wasip1.wasi-root=%{wasi_libc_dir}/sysroot
}
%else
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasi.self-contained=false
--set target.wasm32-wasip1.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasip1.self-contained=false
}
%endif
%endif
@ -793,6 +822,7 @@ fi
test -r "%{profiler}"
%configure --disable-option-checking \
--docdir=%{_pkgdocdir} \
--libdir=%{common_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--set target.%{rust_triple}.linker=%{__cc} \
@ -822,7 +852,6 @@ test -r "%{profiler}"
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \
--enable-verbose-tests \
--dist-compression-formats=gz \
--release-channel=%{channel} \
--release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
@ -911,17 +940,17 @@ find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
# Remove unwanted documentation files (we already package them)
rm -f %{buildroot}%{_docdir}/%{name}/README.md
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
rm -f %{buildroot}%{_docdir}/%{name}/*.old
rm -f %{buildroot}%{_pkgdocdir}/README.md
rm -f %{buildroot}%{_pkgdocdir}/COPYRIGHT
rm -f %{buildroot}%{_pkgdocdir}/LICENSE
rm -f %{buildroot}%{_pkgdocdir}/LICENSE-APACHE
rm -f %{buildroot}%{_pkgdocdir}/LICENSE-MIT
rm -f %{buildroot}%{_pkgdocdir}/LICENSE-THIRD-PARTY
rm -f %{buildroot}%{_pkgdocdir}/*.old
# Sanitize the HTML documentation
find %{buildroot}%{_docdir}/%{name}/html -empty -delete
find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
find %{buildroot}%{_pkgdocdir}/html -empty -delete
find %{buildroot}%{_pkgdocdir}/html -type f -exec chmod -x '{}' '+'
# Create the path for crate-devel packages
mkdir -p %{buildroot}%{_datadir}/cargo/registry
@ -977,7 +1006,11 @@ rm -rf "$TMP_HELLO"
%{__x} test --no-fail-fast --skip src/bootstrap || :
rm -rf "./build/%{rust_triple}/test/"
%{__x} test --no-fail-fast cargo || :
%ifarch aarch64
# https://github.com/rust-lang/rust/issues/123733
%define cargo_test_skip --test-args "--skip panic_abort_doc_tests"
%endif
%{__x} test --no-fail-fast cargo %{?cargo_test_skip} || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__x} test --no-fail-fast clippy || :
@ -1045,6 +1078,15 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%endif
%endif
%if %target_enabled wasm32-wasip1
%target_files wasm32-wasip1
%if %with bundled_wasi_libc
%dir %{rustlibdir}/wasm32-wasip1/lib/self-contained
%{rustlibdir}/wasm32-wasip1/lib/self-contained/crt*.o
%{rustlibdir}/wasm32-wasip1/lib/self-contained/libc.a
%endif
%endif
%if %target_enabled x86_64-unknown-none
%target_files x86_64-unknown-none
%endif
@ -1076,9 +1118,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%files doc
%docdir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/html
%docdir %{_pkgdocdir}
%dir %{_pkgdocdir}
%{_pkgdocdir}/html
# former cargo-doc
%docdir %{_docdir}/cargo
%dir %{_docdir}/cargo

View File

@ -1,23 +0,0 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-02-14 13:00:20.318976752 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-02-14 13:00:28.447051475 +0100
@@ -2110,7 +2110,6 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
dependencies = [
- "cc",
"pkg-config",
"vcpkg",
]
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-02-14 13:00:14.942927327 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-02-14 13:00:40.688164017 +0100
@@ -77,7 +77,7 @@ proptest = "1.4.0"
pulldown-cmark = { version = "0.9.3", default-features = false }
rand = "0.8.5"
regex = "1.10.2"
-rusqlite = { version = "0.30.0", features = ["bundled"] }
+rusqlite = { version = "0.30.0", features = [] }
rustfix = { version = "0.8.0", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.9.2"

View File

@ -1,7 +1,7 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-02-14 14:06:05.881165093 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-02-14 14:06:27.169456166 +0100
@@ -2072,7 +2072,6 @@ checksum = "ee4126d8b4ee5c9d9ea891dd875c
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-04-04 15:01:24.003038403 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-04-04 15:01:24.005038377 -0700
@@ -2111,7 +2111,6 @@ checksum = "ee4126d8b4ee5c9d9ea891dd875c
dependencies = [
"cc",
"libc",
@ -9,7 +9,7 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2113,20 +2112,6 @@ dependencies = [
@@ -2152,20 +2151,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
@ -31,14 +31,14 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
[[package]]
name = "libz-sys"
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-02-14 14:06:10.400226884 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-02-14 14:06:51.225785086 +0100
@@ -44,7 +44,7 @@ curl = "0.4.44"
curl-sys = "0.4.70"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-04-04 15:01:24.005038377 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-04-04 15:02:15.816367069 -0700
@@ -44,7 +44,7 @@ curl = "0.4.46"
curl-sys = "0.4.72"
filetime = "0.2.23"
flate2 = { version = "1.0.28", default-features = false, features = ["zlib"] }
-git2 = "0.18.2"
+git2 = { version = "0.18.2", default-features = false, features = ["https"] }
git2-curl = "0.19.0"
gix = { version = "0.57.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.37.1", package = "gix-features", features = [ "parallel" ] }
gix = { version = "0.58.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.38.0", package = "gix-features", features = [ "parallel" ] }

View File

@ -0,0 +1,23 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-04-04 14:54:45.433205012 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-04-04 14:55:51.949342725 -0700
@@ -2149,7 +2149,6 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"
dependencies = [
- "cc",
"pkg-config",
"vcpkg",
]
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-04-04 14:54:45.433205012 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-04-04 14:55:35.823551771 -0700
@@ -77,7 +77,7 @@ proptest = "1.4.0"
pulldown-cmark = { version = "0.10.0", default-features = false, features = ["html"] }
rand = "0.8.5"
regex = "1.10.3"
-rusqlite = { version = "0.31.0", features = ["bundled"] }
+rusqlite = { version = "0.31.0", features = [] }
rustfix = { version = "0.8.2", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.9.2"

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.77.2-src.tar.xz) = ab099a5e545892f145af9f4c21f41693463248697accf1c92d9afbe6c711639c3859e89c1bb99b84854c462784cc5970fb84dd7c89260ff92174e3684f76920c
SHA512 (rustc-1.78.0-src.tar.xz) = d2fb9881e28849d871fda71b1b51652be3839b3283f0d32163f258c5c707a9fb7b589da8dc03bca2fefee1abdd2b44a5f17e85d8c6df7bea119d1e8d22371941
SHA512 (wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz) = 56306817a6d683aeaf61c3376700804f143b9be101729693c1c88666ea201f02a3e7a3b32150f688a784ac4aae30e46bdbe3fc79a1a9c62e7b460d11ad509045