Skip to content

Commit 7ebc729

Browse files
authored
Merge pull request rust-lang/libm#440 from tgross35/not-always-1-cgu
Don't always set `codegen-units=1`
2 parents e9ba7fa + 4009f0d commit 7ebc729

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

libm/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ exclude = [
6161
[dev-dependencies]
6262
no-panic = "0.1.30"
6363

64-
65-
# This is needed for no-panic to correctly detect the lack of panics
6664
[profile.release]
65+
# Options for no-panic to correctly detect the lack of panics
66+
codegen-units = 1
6767
lto = "fat"
6868

6969
# Release mode with debug assertions
7070
[profile.release-checked]
71-
inherits = "release"
71+
codegen-units = 1
7272
debug-assertions = true
73+
inherits = "release"
7374
lto = "fat"
7475
overflow-checks = true

libm/ci/run.sh

+24-23
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
set -eux
44

55
export RUST_BACKTRACE="${RUST_BACKTRACE:-full}"
6-
# Needed for no-panic to correct detect a lack of panics
7-
export RUSTFLAGS="${RUSTFLAGS:-} -Ccodegen-units=1"
86

97
target="${1:-}"
108

@@ -69,33 +67,36 @@ esac
6967
cargo check -p libm --no-default-features
7068

7169
if [ "${BUILD_ONLY:-}" = "1" ]; then
70+
# If we are on targets that can't run tests, verify that we can build.
7271
cmd="cargo build --target $target --package libm"
7372
$cmd
7473
$cmd --features unstable-intrinsics
7574

7675
echo "can't run tests on $target; skipping"
77-
else
78-
cmd="cargo test --all --target $target $extra_flags"
76+
exit
77+
fi
7978

80-
# Test once without intrinsics
81-
$cmd
79+
# Otherwise, run the test suite.
8280

83-
# Exclude the macros and utile crates from the rest of the tests to save CI
84-
# runtime, they shouldn't have anything feature- or opt-level-dependent.
85-
cmd="$cmd --exclude util --exclude libm-macros"
81+
cmd="cargo test --all --target $target $extra_flags"
8682

87-
# Test once with intrinsics enabled
88-
$cmd --features unstable-intrinsics
89-
$cmd --features unstable-intrinsics --benches
90-
91-
# Test the same in release mode, which also increases coverage. Also ensure
92-
# the soft float routines are checked.
93-
$cmd --profile release-checked
94-
$cmd --profile release-checked --features force-soft-floats
95-
$cmd --profile release-checked --features unstable-intrinsics
96-
$cmd --profile release-checked --features unstable-intrinsics --benches
97-
98-
# Ensure that the routines do not panic.
99-
ENSURE_NO_PANIC=1 cargo build -p libm --target "$target" --no-default-features --release
100-
fi
83+
# Test once without intrinsics
84+
$cmd
85+
86+
# Exclude the macros and utile crates from the rest of the tests to save CI
87+
# runtime, they shouldn't have anything feature- or opt-level-dependent.
88+
cmd="$cmd --exclude util --exclude libm-macros"
89+
90+
# Test once with intrinsics enabled
91+
$cmd --features unstable-intrinsics
92+
$cmd --features unstable-intrinsics --benches
93+
94+
# Test the same in release mode, which also increases coverage. Also ensure
95+
# the soft float routines are checked.
96+
$cmd --profile release-checked
97+
$cmd --profile release-checked --features force-soft-floats
98+
$cmd --profile release-checked --features unstable-intrinsics
99+
$cmd --profile release-checked --features unstable-intrinsics --benches
101100

101+
# Ensure that the routines do not panic.
102+
ENSURE_NO_PANIC=1 cargo build -p libm --target "$target" --no-default-features --release

0 commit comments

Comments
 (0)