Skip to content

Commit 59749e9

Browse files
committed
Auto merge of #143412 - Kobzol:std-detect-in-stdlib, r=Amanieu
Move `std_detect` into stdlib This PR moves the `std_detect` crate from `stdarch` to be a part of rust-lang/rust instead. The first commit actually moves the whole directory from the stdarch Josh subtree, so that git blame history is kept intact. Then I had to make a few changes to appease `tidy`. The most complex thing here is porting the tests. We can't have `std_detect` both in r-l/r and stdarch, because they could get desynchronized, so we have to perform the move more or less "atomically", which means that we also have to port all the existing `std_detect` tests from the `stdarch` repository. The stdarch repo runs the following `std_detect` tests: ### Build The `build-std-detect.sh` script (https://github.com/rust-lang/stdarch/blob/e2b6512aed87df45294ae680181eeef7a802cd95/ci/build-std-detect.sh) builds `std_detect` using the nightly compiler for several targets. This will be subsumed by normal `x build library` on our Tier 1/2 targets. However, the stdarch repository also tests the following targets: - aarch64-unknown-freebsd - armv6-unknown-freebsd - powerpc-unknown-freebsd - powerpc64-unknown-freebsd - aarch64-unknown-openbsd Which we don't build/test on our CI currently. I think we have mostly two options here: 1) Ignore these targets 2) Create a special CI job that will build stage 1 rustc and then cross-compile std (or just the `std_detect` crate?) for these targets. ### Documentation The `dox.sh` script (https://github.com/rust-lang/stdarch/blob/3fec5adcd52a815f227805d4959a25b6402c7fd5/ci/dox.sh) builds and documents `std_detect` for several targets. All of them are Tier 2/we have `dist-` jobs for them, so I think that we can just skip this and let our normal CI subsume it? ### Tests The `run.sh` script (https://github.com/rust-lang/stdarch/blob/1b201cec2cca7465602a65ed6ae60517224b15f3/ci/run.sh) runs `cargo test` on `std_detect` with a bunch of variations of feature flags. This will be subsumed by `x test library` in our CI. The only problem is that `stdarch` runs these tests for a ludicrous number of targets: ``` - tuple: i686-unknown-linux-gnu - tuple: x86_64-unknown-linux-gnu - tuple: arm-unknown-linux-gnueabihf - tuple: armv7-unknown-linux-gnueabihf - tuple: aarch64-unknown-linux-gnu - tuple: aarch64_be-unknown-linux-gnu - tuple: riscv32gc-unknown-linux-gnu - tuple: riscv64gc-unknown-linux-gnu - tuple: powerpc-unknown-linux-gnu - tuple: powerpc64-unknown-linux-gnu - tuple: powerpc64le-unknown-linux-gnu - tuple: s390x-unknown-linux-gnu - tuple: i586-unknown-linux-gnu - tuple: nvptx64-nvidia-cuda - tuple: thumbv6m-none-eabi - tuple: thumbv7m-none-eabi - tuple: thumbv7em-none-eabi - tuple: thumbv7em-none-eabihf - tuple: loongarch64-unknown-linux-gnu - tuple: wasm32-wasip1 - tuple: x86_64-apple-darwin - tuple: x86_64-apple-ios-macabi - tuple: aarch64-apple-darwin - tuple: aarch64-apple-ios-macabi - tuple: x86_64-pc-windows-msvc - tuple: i686-pc-windows-msvc - tuple: aarch64-pc-windows-msvc - tuple: x86_64-pc-windows-gnu - tuple: aarch64-unknown-linux-gnu - tuple: aarch64_be-unknown-linux-gnu - tuple: armv7-unknown-linux-gnueabihf - tuple: loongarch64-unknown-linux-gnu - tuple: powerpc-unknown-linux-gnu - tuple: powerpc64-unknown-linux-gnu - tuple: powerpc64le-unknown-linux-gnu - tuple: riscv32gc-unknown-linux-gnu - tuple: riscv64gc-unknown-linux-gnu - tuple: s390x-unknown-linux-gnu - tuple: x86_64-unknown-linux-gnu - tuple: aarch64-apple-darwin - tuple: aarch64-apple-ios-macabi ``` We definitely do not run *tests* for all of these targets on our CI. # Outcome We have decided to just subsume std_detect tests by our normal test suite for now, and not create a separate CI job. Therefore, this PR performs the following changes in target testing for `std_detect`: The following T3 targets would go from "build" to "nothing": ``` aarch64-unknown-freebsd (T3) armv6-unknown-freebsd (T3) powerpc-unknown-freebsd (T3) powerpc64-unknown-freebsd (T3) aarch64-unknown-openbsd (T3) ``` The following T3 targets would go from "test" to "nothing": ``` aarch64_be-unknown-linux-gnu (T3) riscv32gc-unknown-liux-gnu (T3) ``` The following T2 targets would go from "test" to "build": ``` arm-unknown-linux-gnueabihf (T2) armv7-unknown-linux-gnueabihf (T2) riscv64gc-unknown-linux-gnu (T2) powerpc-unknown-linux-gnu (T2) powerpc64-unknown-linux-gnu (T2) powerpc64le-unknown-linux-gnu (T2) s390x-unknown-linux-gnu (T2) i586-unknown-linux-gnu (T2) loongarch64-unknown-linux-gnu (T2) wasm32-wasip1 (T2) x86_64-apple-ios-macabi (T2) aarch64-apple-ios-macabi (T2) aarch64-pc-windows-msvc (T2) armv7-unknown-linux-gnueabihf (T2) loongarch64-unknown-linux-gnu (T2) powerpc-unknown-linux-gnu (T2) ``` I have confirmed in #1873 that the current version of this PR would pass stdarch's CI testsuite. r? `@ghost` try-job: armhf-gnu try-job: arm-android
2 parents 7b3c175 + ce2b33f commit 59749e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+21
-5537
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ jobs:
258258
# Check that the generated files agree with the checked-in versions.
259259
check-stdarch-gen:
260260
needs: [style]
261-
name: Check stdarch-gen-{arm, loongarch} output
261+
name: Check stdarch-gen-{arm, loongarch} output
262262
runs-on: ubuntu-latest
263263
steps:
264264
- uses: actions/checkout@v4
@@ -277,22 +277,11 @@ jobs:
277277
cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lasx.spec
278278
git diff --exit-code
279279
280-
build-std-detect:
281-
needs: [style]
282-
name: Build std_detect
283-
runs-on: ubuntu-latest
284-
steps:
285-
- uses: actions/checkout@v4
286-
- name: Install Rust
287-
run: rustup update nightly && rustup default nightly
288-
- run: ./ci/build-std-detect.sh
289-
290280
conclusion:
291281
needs:
292282
- docs
293283
- verify
294284
- test
295-
- build-std-detect
296285
- check-stdarch-gen
297286
runs-on: ubuntu-latest
298287
# We need to ensure this job does *not* get skipped if its dependencies fail,

Cargo.lock

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@ stdarch - Rust's standard library SIMD components
44
[![Actions Status](https://github.com/rust-lang/stdarch/workflows/CI/badge.svg)](https://github.com/rust-lang/stdarch/actions)
55

66

7-
# Crates
8-
9-
This repository contains two main crates:
10-
11-
* [`core_arch`](crates/core_arch/README.md) implements `core::arch` - Rust's
12-
core library architecture-specific intrinsics, and
7+
This repository contains the [`core_arch`](crates/core_arch/README.md) crate, which implements `core::arch` - Rust's core library architecture-specific intrinsics.
138

14-
* [`std_detect`](crates/std_detect/README.md) implements `std::detect` - Rust's
15-
standard library run-time CPU feature detection.
16-
179
The `std::simd` component now lives in the
1810
[`packed_simd_2`](https://github.com/rust-lang/packed_simd) crate.
1911

ci/build-std-detect.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

ci/dox.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ dox() {
1616
cargo clean --target "${1}"
1717

1818
cargo build --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml
19-
cargo build --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml
20-
2119
cargo doc --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml
22-
cargo doc --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml
2320
}
2421

2522
if [ -z "$1" ]; then

ci/run-docker.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ run() {
3737
--env NORUN \
3838
--env RUSTFLAGS \
3939
--env CARGO_UNSTABLE_BUILD_STD \
40-
--env RUST_STD_DETECT_UNSTABLE \
4140
--volume "${HOME}/.cargo":/cargo \
4241
--volume "$(rustc --print sysroot)":/rust:ro \
4342
--volume "$(pwd)":/checkout:ro \

ci/run.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,12 @@ cargo_test() {
7878
}
7979

8080
CORE_ARCH="--manifest-path=crates/core_arch/Cargo.toml"
81-
STD_DETECT="--manifest-path=crates/std_detect/Cargo.toml"
8281
STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml"
8382
INTRINSIC_TEST="--manifest-path=crates/intrinsic-test/Cargo.toml"
8483

8584
cargo_test "${CORE_ARCH} ${PROFILE}"
8685

8786
if [ "$NOSTD" != "1" ]; then
88-
cargo_test "${STD_DETECT} ${PROFILE}"
89-
90-
cargo_test "${STD_DETECT} --no-default-features"
91-
cargo_test "${STD_DETECT} --no-default-features --features=std_detect_file_io"
92-
cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval"
93-
cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval,std_detect_file_io"
94-
9587
cargo_test "${STDARCH_EXAMPLES} ${PROFILE}"
9688
fi
9789

@@ -139,7 +131,7 @@ case ${TARGET} in
139131
cargo_test "${PROFILE}"
140132
;;
141133

142-
# Setup aarch64 & armv7 specific variables, the runner, along with some
134+
# Setup aarch64 & armv7 specific variables, the runner, along with some
143135
# tests to skip
144136
aarch64-unknown-linux-gnu*)
145137
TEST_CPPFLAGS="-fuse-ld=lld -I/usr/aarch64-linux-gnu/include/ -I/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu/"

crates/std_detect/Cargo.toml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)