Skip to content

Commit a5ba95e

Browse files
committed
Move builtins-test-intrinsics out of the workspace
This crate doesn't need to be a default member since it requires the opposite settings from everything else. Exclude it from the workspace and run it only when explicitly requested. This also makes `cargo t --no-default-features` work without additional qualifiers. `--no-default-features` still needs to be passed to ensure `#![compiler_builtins]` does not get set. compiler-builtins needs doctests disabled in order for everything to work correctly, since this causes an error running rustdoc that is unrelated to features (our `compiler_builtins` is getting into the crate graph before that from the sysroot, but `#![compiler_builtins]` is not set). We can also remove `test = false` and `doctest = false` in `builtins-test` since these no longer cause issues. This is unlikely to be used but it is better to not quietly skip if anything ever gets added by accident.
1 parent adcb811 commit a5ba95e

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

Cargo.toml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
[workspace]
22
resolver = "3"
33
members = [
4-
# Note that builtins-test-intrinsics cannot be a default member because it
5-
# needs the `mangled-names` feature disabled, while `builtins-test` needs
6-
# it enabled.
74
"builtins-test",
8-
"builtins-test-intrinsics",
95
"compiler-builtins",
106
"crates/libm-macros",
117
"libm",
@@ -24,6 +20,13 @@ default-members = [
2420
"libm",
2521
]
2622

23+
exclude = [
24+
# `builtins-test-intrinsics` needs the feature `compiler-builtins` enabled
25+
# and `mangled-names` disabled, which is the opposite of what is needed for
26+
# other tests, so it makes sense to keep it out of the workspace.
27+
"builtins-test-intrinsics",
28+
]
29+
2730
[profile.release]
2831
panic = "abort"
2932

builtins-test-intrinsics/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ publish = false
66

77
[dependencies]
88
compiler_builtins = { path = "../compiler-builtins", features = ["compiler-builtins"]}
9-
panic-handler = { path = '../crates/panic-handler' }
9+
panic-handler = { path = "../crates/panic-handler" }
1010

1111
[features]
1212
c = ["compiler_builtins/c"]
13+
14+
[profile.release]
15+
panic = "abort"
16+
17+
[profile.dev]
18+
panic = "abort"

builtins-test/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ authors = ["Alex Crichton <[email protected]>"]
55
edition = "2024"
66
publish = false
77

8-
[lib]
9-
test = false
10-
doctest = false
11-
128
[dependencies]
139
# For fuzzing tests we want a deterministic seedable RNG. We also eliminate potential
1410
# problems with system RNGs on the variety of platforms this crate is tested on.

ci/run-docker.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ run() {
1919
echo "target is emulated"
2020
fi
2121

22-
# This directory needs to exist before calling docker, otherwise docker will create it but it
23-
# will be owned by root
22+
# Directories and files that do not yet exist need to be created before
23+
# calling docker, otherwise docker will create them but they will be owned
24+
# by root.
2425
mkdir -p target
26+
cargo generate-lockfile --manifest-path builtins-test-intrinsics/Cargo.toml
2527

2628
run_cmd="HOME=/tmp"
2729

@@ -53,7 +55,8 @@ run() {
5355
# Use rustc provided by a docker image
5456
docker volume create compiler-builtins-cache
5557
build_args=(
56-
"--build-arg" "IMAGE=${DOCKER_BASE_IMAGE:-rustlang/rust:nightly}"
58+
"--build-arg"
59+
"IMAGE=${DOCKER_BASE_IMAGE:-rustlang/rust:nightly}"
5760
)
5861
run_args=(-v "compiler-builtins-cache:/builtins-target")
5962
run_cmd="$run_cmd HOME=/tmp" "USING_CONTAINER_RUSTC=1"

ci/run.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ done
122122
rm -f "${rlib_paths[@]}"
123123

124124
build_intrinsics_test() {
125-
cargo build --target "$target" -v --package builtins-test-intrinsics "$@"
125+
cargo build \
126+
--target "$target" --verbose \
127+
--manifest-path builtins-test-intrinsics/Cargo.toml "$@"
126128
}
127129

128130
# Verify that we haven't dropped any intrinsics/symbols
@@ -133,10 +135,8 @@ build_intrinsics_test --features c --release
133135

134136
# Verify that there are no undefined symbols to `panic` within our
135137
# implementations
136-
CARGO_PROFILE_DEV_LTO=true \
137-
cargo build --target "$target" --package builtins-test-intrinsics
138-
CARGO_PROFILE_RELEASE_LTO=true \
139-
cargo build --target "$target" --package builtins-test-intrinsics --release
138+
CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
139+
CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
140140

141141
# Ensure no references to any symbols from core
142142
update_rlib_paths

compiler-builtins/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ include = [
2525
links = 'compiler-rt'
2626

2727
[lib]
28-
test = false
2928
bench = false
29+
doctest = false
30+
test = false
3031

3132
[dependencies]
3233
# For more information on this dependency see

0 commit comments

Comments
 (0)