From 20b2eedfa424afd4f65eb2604e292d82a4ae615b Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 20 Nov 2024 04:01:06 -0500 Subject: [PATCH] ci: combine and export RUSTFLAGS rather than passing inline This cleans things up and allows us to pass more flags externally. --- ci/build.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ci/build.sh b/ci/build.sh index f43396694bc21..2d1680a9f524b 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -23,6 +23,8 @@ test_target() { target="${2}" no_std="${3}" + RUSTFLAGS="${RUSTFLAGS:-}" + # If there is a std component, fetch it: if [ "${no_std}" != "1" ]; then # FIXME: rustup often fails to download some artifacts due to network @@ -36,15 +38,17 @@ test_target() { n=$((n+1)) sleep 1 done + + # FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings. + RUSTFLAGS="${RUSTFLAGS:-} -Aimproper_ctypes_definitions" + export RUSTFLAGS fi # Test that libc builds without any default features (no std) if [ "$no_std" != "1" ]; then cargo "+$rust" "$build_cmd" --no-default-features --target "$target" else - # FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings. - RUSTFLAGS="-A improper_ctypes_definitions" \ - cargo "+$rust" "$build_cmd" \ + cargo "+$rust" "$build_cmd" \ -Z build-std=core,alloc \ --no-default-features \ --target "$target" @@ -55,8 +59,7 @@ test_target() { if [ "$no_std" != "1" ]; then cargo "+$rust" "$build_cmd" --target "$target" else - RUSTFLAGS="-A improper_ctypes_definitions" \ - cargo "+$rust" "${build_cmd}" \ + cargo "+$rust" "${build_cmd}" \ -Z build-std=core,alloc \ --target "$target" fi @@ -68,8 +71,7 @@ test_target() { --features extra_traits \ --target "$target" else - RUSTFLAGS="-A improper_ctypes_definitions" \ - cargo "+$rust" "$build_cmd" \ + cargo "+$rust" "$build_cmd" \ -Z build-std=core,alloc \ --no-default-features \ --features extra_traits \ @@ -84,8 +86,7 @@ test_target() { --features const-extern-fn \ --target "$target" else - RUSTFLAGS="-A improper_ctypes_definitions" \ - cargo "+$rust" "$build_cmd" \ + cargo "+$rust" "$build_cmd" \ -Z build-std=core,alloc \ --no-default-features \ --features const-extern-fn \ @@ -99,8 +100,7 @@ test_target() { --target "$target" \ --features extra_traits else - RUSTFLAGS="-A improper_ctypes_definitions" \ - cargo "+$rust" "$build_cmd" \ + cargo "+$rust" "$build_cmd" \ -Z build-std=core,alloc \ --target "$target" \ --features extra_traits