Skip to content

Commit af6fc9e

Browse files
committed
ci: combine and export RUSTFLAGS rather than passing inline
This cleans things up and allows us to pass more flags externally. (backport <rust-lang#4124>) (cherry picked from commit 67988b7)
1 parent 129909d commit af6fc9e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ci/build.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ test_target() {
2424
target="${2}"
2525
no_std="${3:-}"
2626

27+
RUSTFLAGS="${RUSTFLAGS:-}"
28+
2729
# If there is a std component, fetch it:
2830
if [ "${no_std}" != "1" ]; then
2931
# FIXME: rustup often fails to download some artifacts due to network
@@ -37,15 +39,17 @@ test_target() {
3739
n=$((n+1))
3840
sleep 1
3941
done
42+
43+
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
44+
RUSTFLAGS="${RUSTFLAGS:-} -Aimproper_ctypes_definitions"
45+
export RUSTFLAGS
4046
fi
4147

4248
# Test that libc builds without any default features (no std)
4349
if [ "$no_std" != "1" ]; then
4450
cargo "+$rust" "$build_cmd" --no-default-features --target "$target"
4551
else
46-
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
47-
RUSTFLAGS="-A improper_ctypes_definitions" \
48-
cargo "+$rust" "$build_cmd" \
52+
cargo "+$rust" "$build_cmd" \
4953
-Z build-std=core,alloc \
5054
--no-default-features \
5155
--target "$target"
@@ -56,8 +60,7 @@ test_target() {
5660
if [ "$no_std" != "1" ]; then
5761
cargo "+$rust" "$build_cmd" --target "$target"
5862
else
59-
RUSTFLAGS="-A improper_ctypes_definitions" \
60-
cargo "+$rust" "${build_cmd}" \
63+
cargo "+$rust" "${build_cmd}" \
6164
-Z build-std=core,alloc \
6265
--target "$target"
6366
fi
@@ -69,8 +72,7 @@ test_target() {
6972
--features extra_traits \
7073
--target "$target"
7174
else
72-
RUSTFLAGS="-A improper_ctypes_definitions" \
73-
cargo "+$rust" "$build_cmd" \
75+
cargo "+$rust" "$build_cmd" \
7476
-Z build-std=core,alloc \
7577
--no-default-features \
7678
--features extra_traits \
@@ -85,8 +87,7 @@ test_target() {
8587
--features const-extern-fn \
8688
--target "$target"
8789
else
88-
RUSTFLAGS="-A improper_ctypes_definitions" \
89-
cargo "+$rust" "$build_cmd" \
90+
cargo "+$rust" "$build_cmd" \
9091
-Z build-std=core,alloc \
9192
--no-default-features \
9293
--features const-extern-fn \
@@ -100,8 +101,7 @@ test_target() {
100101
--target "$target" \
101102
--features extra_traits
102103
else
103-
RUSTFLAGS="-A improper_ctypes_definitions" \
104-
cargo "+$rust" "$build_cmd" \
104+
cargo "+$rust" "$build_cmd" \
105105
-Z build-std=core,alloc \
106106
--target "$target" \
107107
--features extra_traits

0 commit comments

Comments
 (0)