ci: require a nightly compiler rather than using +nightly

If we pin the version of nightly to a specific date then `cargo
+nightly` will stop working. And even locally, if you want to use a
specific version of nightly, you can't if the script is overriding your
version with "+nightly". Instead the user should set RUSTUP_TOOLCHAIN.
This commit is contained in:
Andrew Poelstra 2024-02-20 16:58:25 +00:00
parent e386cbfadf
commit c97f2ccc69
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 12 additions and 2 deletions

View File

@ -148,8 +148,10 @@ loop_features() {
# Lint the workspace then the individual crate examples. # Lint the workspace then the individual crate examples.
do_lint() { do_lint() {
need_nightly
# Use the current (recent/minimal) lock file. # Use the current (recent/minimal) lock file.
local cargo="cargo +nightly --locked" local cargo="cargo --locked"
$cargo clippy --workspace -- -D warnings $cargo clippy --workspace -- -D warnings
@ -181,7 +183,8 @@ do_dup_deps() {
# Build the docs with a nightly toolchain, in unison with the function # Build the docs with a nightly toolchain, in unison with the function
# below this checks that we feature guarded docs imports correctly. # below this checks that we feature guarded docs imports correctly.
build_docs_with_nightly_toolchain() { build_docs_with_nightly_toolchain() {
local cargo="cargo +nightly --locked" need_nightly
local cargo="cargo --locked"
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" $cargo doc --all-features RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" $cargo doc --all-features
} }
@ -242,6 +245,13 @@ need_cmd() {
fi fi
} }
need_nightly() {
cargo_ver=$(cargo --version)
if echo "$cargo_ver" | grep -q -v nightly; then
err "Need a nightly compiler; have $(cargo --version)"
fi
}
err() { err() {
echo "$1" >&2 echo "$1" >&2
exit 1 exit 1