Skip to content

Commit a69df72

Browse files
committed
Auto merge of rust-lang#132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#131261 (Stabilize `UnsafeCell::from_mut`) - rust-lang#131405 (bootstrap/codegen_ssa: ship llvm-strip and use it for -Cstrip) - rust-lang#132077 (Add a new `wide-arithmetic` feature for WebAssembly) - rust-lang#132562 (Remove the `wasm32-wasi` target from rustc) - rust-lang#132660 (Remove unused errs.rs file) Failed merges: - rust-lang#131721 (Add new unstable feature `const_eq_ignore_ascii_case`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4a91ff6 + 92c1ad8 commit a69df72

File tree

25 files changed

+65
-151
lines changed

25 files changed

+65
-151
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+3
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
277277
("x86", s) if s.starts_with("avx512") => {
278278
Some(LLVMFeature::with_dependency(s, TargetFeatureFoldStrength::EnableOnly("evex512")))
279279
}
280+
// Support for `wide-arithmetic` will first land in LLVM 20 as part of
281+
// llvm/llvm-project#111598
282+
("wasm32" | "wasm64", "wide-arithmetic") if get_version() < (20, 0, 0) => None,
280283
(_, s) => Some(LLVMFeature::new(s)),
281284
}
282285
}

compiler/rustc_codegen_ssa/messages.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ codegen_ssa_L4Bender_exporting_symbols_unimplemented = exporting symbols not imp
22
33
codegen_ssa_add_native_library = failed to add native library {$library_path}: {$error}
44
5+
codegen_ssa_aix_strip_not_used = using host's `strip` binary to cross-compile to AIX which is not guaranteed to work
6+
57
codegen_ssa_apple_deployment_target_invalid =
68
failed to parse deployment target specified in {$env_var}: {$error}
79

compiler/rustc_codegen_ssa/src/back/link.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,7 @@ fn link_natively(
10851085
let strip = sess.opts.cg.strip;
10861086

10871087
if sess.target.is_like_osx {
1088-
// Use system `strip` when running on host macOS.
1089-
// <https://github.com/rust-lang/rust/pull/130781>
1090-
let stripcmd = if cfg!(target_os = "macos") { "/usr/bin/strip" } else { "strip" };
1088+
let stripcmd = "rust-objcopy";
10911089
match (strip, crate_type) {
10921090
(Strip::Debuginfo, _) => {
10931091
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S"))
@@ -1103,11 +1101,14 @@ fn link_natively(
11031101
}
11041102
}
11051103

1106-
if sess.target.os == "illumos" {
1104+
if sess.target.is_like_solaris {
11071105
// Many illumos systems will have both the native 'strip' utility and
11081106
// the GNU one. Use the native version explicitly and do not rely on
11091107
// what's in the path.
1110-
let stripcmd = "/usr/bin/strip";
1108+
//
1109+
// If cross-compiling and there is not a native version, then use
1110+
// `llvm-strip` and hope.
1111+
let stripcmd = if !sess.host.is_like_solaris { "rust-objcopy" } else { "/usr/bin/strip" };
11111112
match strip {
11121113
// Always preserve the symbol table (-x).
11131114
Strip::Debuginfo => {
@@ -1120,6 +1121,10 @@ fn link_natively(
11201121
}
11211122

11221123
if sess.target.is_like_aix {
1124+
// `llvm-strip` doesn't work for AIX - their strip must be used.
1125+
if !sess.host.is_like_aix {
1126+
sess.dcx().emit_warn(errors::AixStripNotUsed);
1127+
}
11231128
let stripcmd = "/usr/bin/strip";
11241129
match strip {
11251130
Strip::Debuginfo => {
@@ -1147,6 +1152,13 @@ fn strip_symbols_with_external_utility(
11471152
if let Some(option) = option {
11481153
cmd.arg(option);
11491154
}
1155+
1156+
let mut new_path = sess.get_tools_search_paths(false);
1157+
if let Some(path) = env::var_os("PATH") {
1158+
new_path.extend(env::split_paths(&path));
1159+
}
1160+
cmd.env("PATH", env::join_paths(new_path).unwrap());
1161+
11501162
let prog = cmd.arg(out_filename).output();
11511163
match prog {
11521164
Ok(prog) => {

compiler/rustc_codegen_ssa/src/errors.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1110,3 +1110,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_
11101110
diag
11111111
}
11121112
}
1113+
1114+
#[derive(Diagnostic)]
1115+
#[diag(codegen_ssa_aix_strip_not_used)]
1116+
pub(crate) struct AixStripNotUsed;

compiler/rustc_hir_analysis/src/check/errs.rs

-88
This file was deleted.

compiler/rustc_session/src/config.rs

-13
Original file line numberDiff line numberDiff line change
@@ -1351,19 +1351,6 @@ pub fn build_target_config(early_dcx: &EarlyDiagCtxt, opts: &Options, sysroot: &
13511351
early_dcx.early_warn(warning)
13521352
}
13531353

1354-
// The `wasm32-wasi` target is being renamed to `wasm32-wasip1` as
1355-
// part of rust-lang/compiler-team#607 and
1356-
// rust-lang/compiler-team#695. Warn unconditionally on usage to
1357-
// raise awareness of the renaming. This code will be deleted in
1358-
// October 2024.
1359-
if opts.target_triple.tuple() == "wasm32-wasi" {
1360-
early_dcx.early_warn(
1361-
"the `wasm32-wasi` target is being renamed to \
1362-
`wasm32-wasip1` and the `wasm32-wasi` target will be \
1363-
removed from nightly in October 2024 and removed from \
1364-
stable Rust in January 2025",
1365-
)
1366-
}
13671354
if !matches!(target.pointer_width, 16 | 32 | 64) {
13681355
early_dcx.early_fatal(format!(
13691356
"target specification was invalid: unrecognized target-pointer-width {}",

compiler/rustc_target/src/spec/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,6 @@ supported_targets! {
18051805
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
18061806
("wasm32-unknown-unknown", wasm32_unknown_unknown),
18071807
("wasm32v1-none", wasm32v1_none),
1808-
("wasm32-wasi", wasm32_wasi),
18091808
("wasm32-wasip1", wasm32_wasip1),
18101809
("wasm32-wasip2", wasm32_wasip2),
18111810
("wasm32-wasip1-threads", wasm32_wasip1_threads),

compiler/rustc_target/src/spec/targets/wasm32_wasi.rs

-11
This file was deleted.

compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
1717

1818
options.os = "wasi".into();
1919
options.env = "p1".into();
20-
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
20+
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);
2121

2222
options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
2323
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@@ -47,7 +47,7 @@ pub(crate) fn target() -> Target {
4747
options.entry_name = "__main_void".into();
4848

4949
Target {
50-
llvm_target: "wasm32-wasi".into(),
50+
llvm_target: "wasm32-wasip1".into(),
5151
metadata: crate::spec::TargetMetadata {
5252
description: Some("WebAssembly with WASI".into()),
5353
tier: Some(2),

compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! The `wasm32-wasip2` target is the next evolution of the
2-
//! wasm32-wasi target. While the wasi specification is still under
2+
//! wasm32-wasip1 target. While the wasi specification is still under
33
//! active development, the preview 2 iteration is considered an "island
44
//! of stability" that should allow users to rely on it indefinitely.
55
//!

compiler/rustc_target/src/target_features.rs

+1
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ const WASM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
470470
("relaxed-simd", Stable, &["simd128"]),
471471
("sign-ext", Stable, &[]),
472472
("simd128", Stable, &[]),
473+
("wide-arithmetic", Unstable(sym::wasm_target_feature), &[]),
473474
// tidy-alphabetical-end
474475
];
475476

library/core/src/cell.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,6 @@ impl<T: ?Sized> UnsafeCell<T> {
21222122
/// # Examples
21232123
///
21242124
/// ```
2125-
/// # #![feature(unsafe_cell_from_mut)]
21262125
/// use std::cell::UnsafeCell;
21272126
///
21282127
/// let mut val = 42;
@@ -2132,7 +2131,9 @@ impl<T: ?Sized> UnsafeCell<T> {
21322131
/// assert_eq!(*uc.get_mut(), 41);
21332132
/// ```
21342133
#[inline(always)]
2135-
#[unstable(feature = "unsafe_cell_from_mut", issue = "111645")]
2134+
#[stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")]
2135+
#[rustc_const_stable(feature = "unsafe_cell_from_mut", since = "CURRENT_RUSTC_VERSION")]
2136+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
21362137
pub const fn from_mut(value: &mut T) -> &mut UnsafeCell<T> {
21372138
// SAFETY: `UnsafeCell<T>` has the same memory layout as `T` due to #[repr(transparent)].
21382139
unsafe { &mut *(value as *mut T as *mut UnsafeCell<T>) }

src/bootstrap/src/core/build_steps/compile.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ impl Step for Std {
219219
.join(compiler.host)
220220
.join("bin");
221221
if src_sysroot_bin.exists() {
222-
let target_sysroot_bin =
223-
builder.sysroot_target_libdir(compiler, target).parent().unwrap().join("bin");
222+
let target_sysroot_bin = builder.sysroot_target_bindir(compiler, target);
224223
t!(fs::create_dir_all(&target_sysroot_bin));
225224
builder.cp_link_r(&src_sysroot_bin, &target_sysroot_bin);
226225
}
@@ -1977,6 +1976,14 @@ impl Step for Assemble {
19771976
}
19781977
}
19791978

1979+
{
1980+
// `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`,
1981+
// so copy and rename `llvm-objcopy`.
1982+
let src_exe = exe("llvm-objcopy", target_compiler.host);
1983+
let dst_exe = exe("rust-objcopy", target_compiler.host);
1984+
builder.copy_link(&libdir_bin.join(src_exe), &libdir_bin.join(dst_exe));
1985+
}
1986+
19801987
// In addition to `rust-lld` also install `wasm-component-ld` when
19811988
// LLD is enabled. This is a relatively small binary that primarily
19821989
// delegates to the `rust-lld` binary for linking and then runs

src/bootstrap/src/core/build_steps/dist.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ impl Step for Rustc {
459459

460460
// Copy over lld if it's there
461461
if builder.config.lld_enabled {
462-
let src_dir =
463-
builder.sysroot_target_libdir(compiler, host).parent().unwrap().join("bin");
462+
let src_dir = builder.sysroot_target_bindir(compiler, host);
464463
let rust_lld = exe("rust-lld", compiler.host);
465464
builder.copy_link(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld));
466465
let self_contained_lld_src_dir = src_dir.join("gcc-ld");
@@ -474,9 +473,16 @@ impl Step for Rustc {
474473
);
475474
}
476475
}
476+
477+
{
478+
let src_dir = builder.sysroot_target_bindir(compiler, host);
479+
let llvm_objcopy = exe("llvm-objcopy", compiler.host);
480+
let rust_objcopy = exe("rust-objcopy", compiler.host);
481+
builder.copy_link(&src_dir.join(&llvm_objcopy), &dst_dir.join(&rust_objcopy));
482+
}
483+
477484
if builder.tool_enabled("wasm-component-ld") {
478-
let src_dir =
479-
builder.sysroot_target_libdir(compiler, host).parent().unwrap().join("bin");
485+
let src_dir = builder.sysroot_target_bindir(compiler, host);
480486
let ld = exe("wasm-component-ld", compiler.host);
481487
builder.copy_link(&src_dir.join(&ld), &dst_dir.join(&ld));
482488
}

src/bootstrap/src/core/builder/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,11 @@ impl<'a> Builder<'a> {
11611161
self.ensure(compile::Sysroot::new(compiler))
11621162
}
11631163

1164+
/// Returns the bindir for a compiler's sysroot.
1165+
pub fn sysroot_target_bindir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {
1166+
self.sysroot_target_libdir(compiler, target).parent().unwrap().join("bin")
1167+
}
1168+
11641169
/// Returns the libdir where the standard library and other artifacts are
11651170
/// found for a compiler's sysroot.
11661171
pub fn sysroot_target_libdir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {

src/ci/docker/host-x86_64/dist-various-2/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS \
114114
ENV TARGETS=x86_64-unknown-fuchsia
115115
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
116116
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
117-
ENV TARGETS=$TARGETS,wasm32-wasi
118117
ENV TARGETS=$TARGETS,wasm32-wasip1
119118
ENV TARGETS=$TARGETS,wasm32-wasip1-threads
120119
ENV TARGETS=$TARGETS,wasm32-wasip2

src/doc/rustc/src/platform-support.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ target | std | notes
192192
[`thumbv8m.main-none-eabihf`](platform-support/thumbv8m.main-none-eabi.md) | * | Bare Armv8-M Mainline, hardfloat
193193
[`wasm32-unknown-emscripten`](platform-support/wasm32-unknown-emscripten.md) | ✓ | WebAssembly via Emscripten
194194
[`wasm32-unknown-unknown`](platform-support/wasm32-unknown-unknown.md) | ✓ | WebAssembly
195-
`wasm32-wasi` | ✓ | WebAssembly with WASI (undergoing a [rename to `wasm32-wasip1`][wasi-rename])
196-
[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASI
195+
[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASIp1
196+
[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | WebAssembly with WASIp2
197197
[`wasm32-wasip1-threads`](platform-support/wasm32-wasip1-threads.md) | ✓ | WebAssembly with WASI Preview 1 and threads
198198
[`wasm32v1-none`](platform-support/wasm32v1-none.md) | * | WebAssembly limited to 1.0 features and no imports
199199
[`x86_64-apple-ios`](platform-support/apple-ios.md) | ✓ | 64-bit x86 iOS
@@ -377,7 +377,6 @@ target | std | host | notes
377377
`thumbv7a-pc-windows-msvc` | ✓ | |
378378
`thumbv7a-uwp-windows-msvc` | ✓ | |
379379
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.3
380-
[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | | WebAssembly
381380
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
382381
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
383382
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator

src/doc/rustc/src/platform-support/wasm32-wasip1.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ the target with:
9898
rustup target add wasm32-wasip1
9999
```
100100

101-
> **Note**: the `wasm32-wasip1` target is new and may only be available
102-
> on nightly by the time you're reading this. If `wasm32-wasip1` isn't
103-
> available on stable Rust then `wasm32-wasi` should be available instead.
104-
105101
Rust programs can be built for that target:
106102

107103
```text

src/doc/unstable-book/src/compiler-flags/wasm-c-abi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This option controls whether Rust uses the spec-compliant C ABI when compiling
44
for the `wasm32-unknown-unknown` target.
55

66
This makes it possible to be ABI-compatible with all other spec-compliant Wasm
7-
like Rusts `wasm32-wasi`.
7+
like Rusts `wasm32-wasip1`.
88

99
This compiler flag is perma-unstable, as it will be enabled by default in the
1010
future with no option to fall back to the old non-spec-compliant ABI.

src/tools/build-manifest/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ static TARGETS: &[&str] = &[
157157
"thumbv8m.main-none-eabihf",
158158
"wasm32-unknown-emscripten",
159159
"wasm32-unknown-unknown",
160-
"wasm32-wasi",
161160
"wasm32-wasip1",
162161
"wasm32-wasip1-threads",
163162
"wasm32-wasip2",

src/tools/compiletest/src/header/tests.rs

-4
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,6 @@ fn wasm_special() {
583583
("wasm32-unknown-emscripten", "emscripten", true),
584584
("wasm32-unknown-emscripten", "wasm32", true),
585585
("wasm32-unknown-emscripten", "wasm32-bare", false),
586-
("wasm32-wasi", "emscripten", false),
587-
("wasm32-wasi", "wasm32", true),
588-
("wasm32-wasi", "wasm32-bare", false),
589-
("wasm32-wasi", "wasi", true),
590586
("wasm32-wasip1", "emscripten", false),
591587
("wasm32-wasip1", "wasm32", true),
592588
("wasm32-wasip1", "wasm32-bare", false),

0 commit comments

Comments
 (0)