Skip to content

Commit

Permalink
Auto merge of #128030 - GuillaumeGomez:rollup-pp031e7, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #126450 (Promote Mac Catalyst targets to Tier 2, and ship with rustup)
 - #127177 (Distribute rustc_codegen_cranelift for arm64 macOS)
 - #127583 (Deal with invalid UTF-8 from `gai_strerror`)
 - #127977 (Update wasi-sdk in CI to latest release)
 - #127985 (Migrate `test-benches`, `c-unwind-abi-catch-panic` and `compiler-lookup-paths-2` `run-make` tests to rmake)
 - #128014 (Fix stab display in doc blocks)
 - #128023 (rustdoc: short descriptions cause word-breaks in tables)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jul 21, 2024
2 parents 92c6c03 + ade4026 commit 8cd834e
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 56 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For more docs on how to build and test see [build_system/usage.txt](build_system
|FreeBSD|[^no-rustup]||||
|AIX|[^xcoff]|N/A|N/A|[^xcoff]|
|Other unixes|||||
|macOS||[^no-rustup]|N/A|N/A|
|macOS|||N/A|N/A|
|Windows|[^no-rustup]||N/A|N/A|

✅: Fully supported and tested
Expand Down
5 changes: 3 additions & 2 deletions library/std/src/sys/pal/unix/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
use crate::mem;
use crate::net::{Shutdown, SocketAddr};
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
use crate::str;
use crate::sys::fd::FileDesc;
use crate::sys::pal::unix::IsMinusOne;
use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr};
Expand Down Expand Up @@ -47,7 +46,9 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {

#[cfg(not(target_os = "espidf"))]
let detail = unsafe {
str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap().to_owned()
// We can't always expect a UTF-8 environment. When we don't get that luxury,
// it's better to give a low-quality error message than none at all.
CStr::from_ptr(libc::gai_strerror(err)).to_string_lossy()
};

#[cfg(target_os = "espidf")]
Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ pub fn target_supports_cranelift_backend(target: TargetSelection) -> bool {
|| target.contains("aarch64")
|| target.contains("s390x")
|| target.contains("riscv64gc")
} else if target.contains("darwin") || target.is_windows() {
} else if target.contains("darwin") {
target.contains("x86_64") || target.contains("aarch64")
} else if target.is_windows() {
target.contains("x86_64")
} else {
false
Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/host-x86_64/dist-various-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun
COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh

RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz | \
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz | \
tar -xz
ENV WASI_SDK_PATH=/tmp/wasi-sdk-22.0
ENV WASI_SDK_PATH=/tmp/wasi-sdk-23.0-x86_64-linux

COPY scripts/freebsd-toolchain.sh /tmp/
RUN /tmp/freebsd-toolchain.sh i686
Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/host-x86_64/test-various/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ WORKDIR /
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz | \
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz | \
tar -xz
ENV WASI_SDK_PATH=/wasi-sdk-22.0
ENV WASI_SDK_PATH=/wasi-sdk-23.0-x86_64-linux

ENV RUST_CONFIGURE_ARGS \
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
Expand Down
3 changes: 2 additions & 1 deletion src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ auto:

- image: dist-apple-various
env:
SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim,aarch64-apple-ios-macabi,x86_64-apple-ios-macabi
RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.12
Expand Down Expand Up @@ -326,6 +326,7 @@ auto:
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-macos-m1

# This target only needs to support 11.0 and up as nothing else supports the hardware
Expand Down
4 changes: 2 additions & 2 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ so Rustup may install the documentation for a similar tier 1 target instead.
target | std | notes
-------|:---:|-------
[`aarch64-apple-ios`](platform-support/apple-ios.md) | ✓ | ARM64 iOS
[`aarch64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | Mac Catalyst on ARM64
[`aarch64-apple-ios-sim`](platform-support/apple-ios.md) | ✓ | Apple iOS Simulator on ARM64
`aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia`
[`aarch64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | ARM64 Fuchsia
Expand Down Expand Up @@ -195,6 +196,7 @@ target | std | notes
[`wasm32-wasip1`](platform-support/wasm32-wasip1.md) | ✓ | WebAssembly with WASI
[`wasm32-wasip1-threads`](platform-support/wasm32-wasip1-threads.md) | ✓ | WebAssembly with WASI Preview 1 and threads
[`x86_64-apple-ios`](platform-support/apple-ios.md) | ✓ | 64-bit x86 iOS
[`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | Mac Catalyst on x86_64
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
`x86_64-fuchsia` | ✓ | Alias for `x86_64-unknown-fuchsia`
[`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
Expand Down Expand Up @@ -244,7 +246,6 @@ target | std | host | notes
-------|:---:|:----:|-------
[`arm64e-apple-ios`](platform-support/arm64e-apple-ios.md) | ✓ | | ARM64e Apple iOS
[`arm64e-apple-darwin`](platform-support/arm64e-apple-darwin.md) | ✓ | ✓ | ARM64e Apple Darwin
[`aarch64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | | Apple Catalyst on ARM64
[`aarch64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | ARM64 tvOS
[`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | ✓ | | ARM64 tvOS Simulator
[`aarch64-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS
Expand Down Expand Up @@ -370,7 +371,6 @@ target | std | host | notes
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.3
[`wasm32-wasip2`](platform-support/wasm32-wasip2.md) | ✓ | | WebAssembly
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
[`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | | Apple Catalyst on x86_64
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator
[`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS |
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support/apple-ios-macabi.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Apple Mac Catalyst targets.

**Tier: 3**
**Tier: 2 (without Host Tools)**

- `aarch64-apple-ios-macabi`: Mac Catalyst on ARM64.
- `x86_64-apple-ios-macabi`: Mac Catalyst on 64-bit x86.
Expand Down
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ pre, .rustdoc.src .example-wrap {
background: var(--table-alt-row-background-color);
}

.docblock .stab, .docblock-short .stab {
display: inline-block;
}

/* "where ..." clauses with block display are also smaller */
div.where {
white-space: pre-wrap;
Expand Down Expand Up @@ -953,6 +957,7 @@ table,
display: table;
padding: 0;
margin: 0;
width: 100%;
}
.item-table > li {
display: table-row;
Expand Down
2 changes: 2 additions & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static TARGETS: &[&str] = &[
"arm64e-apple-darwin",
"aarch64-apple-ios",
"arm64e-apple-ios",
"aarch64-apple-ios-macabi",
"aarch64-apple-ios-sim",
"aarch64-unknown-fuchsia",
"aarch64-linux-android",
Expand Down Expand Up @@ -160,6 +161,7 @@ static TARGETS: &[&str] = &[
"wasm32-wasip2",
"x86_64-apple-darwin",
"x86_64-apple-ios",
"x86_64-apple-ios-macabi",
"x86_64-fortanix-unknown-sgx",
"x86_64-unknown-fuchsia",
"x86_64-linux-android",
Expand Down
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ run-make/branch-protection-check-IBT/Makefile
run-make/c-dynamic-dylib/Makefile
run-make/c-dynamic-rlib/Makefile
run-make/c-unwind-abi-catch-lib-panic/Makefile
run-make/c-unwind-abi-catch-panic/Makefile
run-make/cat-and-grep-sanity-check/Makefile
run-make/cdylib-dylib-linkage/Makefile
run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
run-make/cross-lang-lto-clang/Makefile
run-make/cross-lang-lto-pgo-smoketest/Makefile
Expand Down Expand Up @@ -90,7 +88,6 @@ run-make/staticlib-dylib-linkage/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/sysroot-crates-are-unstable/Makefile
run-make/test-benches/Makefile
run-make/thumb-none-cortex-m/Makefile
run-make/thumb-none-qemu/Makefile
run-make/translation/Makefile
Expand Down
10 changes: 0 additions & 10 deletions tests/run-make/c-unwind-abi-catch-panic/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/c-unwind-abi-catch-panic/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A test for calling `C-unwind` functions across foreign function boundaries (FFI).
// This test triggers a panic when calling a foreign function that calls *back* into Rust.
// This catches a panic across an FFI boundary and downcasts it into an integer.
// The Rust code that panics is in the same directory, unlike `c-unwind-abi-catch-lib-panic`.
// See https://github.com/rust-lang/rust/pull/76570

//@ ignore-cross-compile
// Reason: the compiled binary is executed
//@ needs-unwind
// Reason: this test exercises panic unwinding

use run_make_support::{build_native_static_lib, run, rustc};

fn main() {
build_native_static_lib("add");
rustc().input("main.rs").run();
run("main");
}
11 changes: 0 additions & 11 deletions tests/run-make/compiler-lookup-paths-2/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/compiler-lookup-paths-2/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This test checks that extern crate declarations in Cargo without a corresponding declaration
// in the manifest of a dependency are NOT allowed. The last rustc call does it anyways, which
// should result in a compilation failure.
// See https://github.com/rust-lang/rust/pull/21113

use run_make_support::{path, rfs, rust_lib_name, rustc};

fn main() {
rfs::create_dir("a");
rfs::create_dir("b");
rustc().input("a.rs").run();
rfs::rename(rust_lib_name("a"), path("a").join(rust_lib_name("a")));
rustc().input("b.rs").library_search_path("a").run();
rfs::rename(rust_lib_name("b"), path("b").join(rust_lib_name("b")));
rustc()
.input("c.rs")
.library_search_path("crate=b")
.library_search_path("dependency=a")
.run_fail();
}
12 changes: 0 additions & 12 deletions tests/run-make/test-benches/Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions tests/run-make/test-benches/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// #[bench] is a Rust feature to run benchmarks on performance-critical
// code, which previously experienced a runtime panic bug in #103794.
// In order to ensure future breakages of this feature are detected, this
// smoke test was created, using the benchmarking feature with various
// runtime flags.
// See https://github.com/rust-lang/rust/issues/103794

//@ ignore-cross-compile
// Reason: the compiled binary is executed
//@ needs-unwind
// Reason: #[bench] and -Zpanic-abort-tests can't be combined

use run_make_support::{run, run_with_args, rustc};

fn main() {
// Smoke-test that #[bench] isn't entirely broken.
rustc().arg("--test").input("smokebench.rs").opt().run();
run_with_args("smokebench", &["--bench"]);
run_with_args("smokebench", &["--bench", "noiter"]);
run_with_args("smokebench", &["--bench", "yesiter"]);
run("smokebench");
}
9 changes: 8 additions & 1 deletion tests/run-make/wasm-panic-small/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ fn main() {
fn test(cfg: &str) {
eprintln!("running cfg {cfg:?}");

rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().cfg(cfg).run();
rustc()
.input("foo.rs")
.target("wasm32-wasip1")
.arg("-Clto")
.arg("-Cstrip=debuginfo")
.opt()
.cfg(cfg)
.run();

let bytes = rfs::read("foo.wasm");
println!("{}", bytes.len());
Expand Down
8 changes: 7 additions & 1 deletion tests/run-make/wasm-stringify-ints-small/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
use run_make_support::{rfs, rustc};

fn main() {
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
rustc()
.input("foo.rs")
.target("wasm32-wasip1")
.arg("-Clto")
.arg("-Cstrip=debuginfo")
.opt()
.run();

let bytes = rfs::read("foo.wasm");
println!("{}", bytes.len());
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/source-code-page-code-scroll.goml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
set-window-size: (800, 1000)
// "scrollWidth" should be superior than "clientWidth".
assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800})
assert-property: ("body", {"scrollWidth": 1114, "clientWidth": 800})

// Both properties should be equal (ie, no scroll on the code block).
assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933})
assert-property: (".example-wrap .rust", {"scrollWidth": 1000, "clientWidth": 1000})
8 changes: 4 additions & 4 deletions tests/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated
Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
</span>.
Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
</span>.
Finally, you can use `quz` only on <span class="stab portability" data-span="1"><code>Unix or x86-64
</code></span>.
Finally, you can use `quz` only on <span class="stab portability" data-span="2"><code>Unix or x86-64
</code></span>.
*/

use std::convert::AsRef;
Expand Down
9 changes: 9 additions & 0 deletions tests/rustdoc-gui/stab-in-doc.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This test ensure that `stab` elements if used in doc blocks are not breaking the text layout.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// We make the window wide enough for the two stabs who are looking into to be on the same line.
set-window-size: (1100, 600)
compare-elements-position: (
".top-doc .docblock span[data-span='1']",
".top-doc .docblock span[data-span='2']",
["y"],
)

0 comments on commit 8cd834e

Please sign in to comment.