From c97f2ccc6959128514f3c3023b455ef6f8c208a9 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 20 Feb 2024 16:58:25 +0000 Subject: [PATCH] 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. --- contrib/run_task.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/run_task.sh b/contrib/run_task.sh index 105dd0cc..f7aa21ac 100755 --- a/contrib/run_task.sh +++ b/contrib/run_task.sh @@ -148,8 +148,10 @@ loop_features() { # Lint the workspace then the individual crate examples. do_lint() { + need_nightly + # Use the current (recent/minimal) lock file. - local cargo="cargo +nightly --locked" + local cargo="cargo --locked" $cargo clippy --workspace -- -D warnings @@ -181,7 +183,8 @@ do_dup_deps() { # Build the docs with a nightly toolchain, in unison with the function # below this checks that we feature guarded docs imports correctly. 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 } @@ -242,6 +245,13 @@ need_cmd() { 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() { echo "$1" >&2 exit 1