Skip to content

Commit

Permalink
tools: --check-cfg has been stabilized
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 17, 2024
1 parent a9be40b commit 6759eee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,13 @@ if [[ "${rustc_version}" == *"nightly"* ]] || [[ "${rustc_version}" == *"dev"* ]
if [[ -z "${is_custom_toolchain}" ]]; then
rustup ${pre_args[@]+"${pre_args[@]}"} component add rust-src &>/dev/null
fi
# The latest syntax of -Z check-cfg requires 1.75.0-nightly.
# The latest syntax of cargo -Z check-cfg requires 1.75.0-nightly.
# rustc --check-cfg has been stabilized in 1.79.
# We only check this on the recent nightly to avoid old clippy bugs.
# shellcheck disable=SC2207
if [[ "${rustc_minor_version}" -ge 79 ]] && [[ -n "${TESTS:-}" ]] && [[ -z "${TARGET_GROUP:-}" ]]; then
build_scripts=(build.rs portable-atomic-util/build.rs)
check_cfg='-Z unstable-options --check-cfg=cfg(target_pointer_width,values("128")) --check-cfg=cfg(target_arch,values("xtensa")) --check-cfg=cfg(target_feature,values("lse2","lse128","rcpc3","quadword-atomics","fast-serialization","load-store-on-cond","distinct-ops","miscellaneous-extensions-3"))'
check_cfg='--check-cfg=cfg(target_pointer_width,values("128")) --check-cfg=cfg(target_arch,values("xtensa")) --check-cfg=cfg(target_feature,values("lse2","lse128","rcpc3","quadword-atomics","fast-serialization","load-store-on-cond","distinct-ops","miscellaneous-extensions-3"))'
known_cfgs+=($(grep -E 'cargo:rustc-cfg=' "${build_scripts[@]}" | sed -E 's/^.*cargo:rustc-cfg=//; s/(=\\)?".*$//' | LC_ALL=C sort -u))
# TODO: handle multi-line target_feature_if
known_target_feature_values+=($(grep -E 'target_feature_if\("' "${build_scripts[@]}" | sed -E 's/^.*target_feature_if\(//; s/",.*$/"/' | LC_ALL=C sort -u))
Expand Down

0 comments on commit 6759eee

Please sign in to comment.