Thanks to visit codestin.com
Credit goes to github.com

Skip to content

build_tools/check.sh: check for Rust version updates; bump MSRV#11960

Closed
krobelus wants to merge 11 commits intofish-shell:masterfrom
krobelus:no-more-stale-rust
Closed

build_tools/check.sh: check for Rust version updates; bump MSRV#11960
krobelus wants to merge 11 commits intofish-shell:masterfrom
krobelus:no-more-stale-rust

Conversation

@krobelus
Copy link
Contributor

Opt-in because we don't want failures not related to local changes,
see d93fc5e (Revert "build_tools/check.sh: check that stable rust
is up-to-date", 2025-08-10).

For the same reason, it's not currently checked by CI, though we
could definitely have "renovatebot" do this in future.

Also upgrade our MSRV to 1.85.

Daniel Rainer added 2 commits October 17, 2025 13:20
These comments should be placed on top of the line they're commenting on.
Multi-line postfix comments will no longer be aligned using rustfmt's
style edition 2024, so fix this now to prevent formatting issues later.
For consistency, single-line postfix comments are also moved.

Part of fish-shell#11959
This commit adds `style_edition = "2024"` as a rustfmt config setting.
All other changes are automatically generated by `cargo fmt`.

The 2024 style edition fixes several bugs and changes some defaults.
https://doc.rust-lang.org/edition-guide/rust-2024/rustfmt-style-edition.html

Most of the changes made to our code result from a different sorting
method for `use` statements, improved ability to split long lines, and
contraction of short trailing expressions into single-line expressions.

While our MSRV is still 1.70, we use more recent toolchains for
development, so we can already benefit from the improvements of the new
style edition. Formatting is not require for building fish, so builds
with Rust 1.70 are not affected by this change.

More context can be found at
fish-shell#11630 (comment)

Closes fish-shell#11959
@krobelus krobelus force-pushed the no-more-stale-rust branch 2 times, most recently from e84a192 to d2b06f6 Compare October 17, 2025 12:20
Daniel Rainer and others added 9 commits October 17, 2025 14:27
Update our MSRV to Rust 1.85.

Includes fixes for lints which were previously suppressed due to them
relying on features added after Rust 1.70.

Rust 1.85 prints a warning when using `#[cfg(target_os = "cygwin")]`, so
we work around the one instance where this is a problem for now. This
workaround can be reverted when we update to Rust 1.86 or newer.

Closes fish-shell#11961
The backport is no longer necessary with our new MSRV.

Part of fish-shell#11964
The backport is no longer necessary with our new MSRV.

Part of fish-shell#11964
Some annotations are no longer needed with more recent clippy (1.85+),
so let's remove them.

Closes fish-shell#11964
No particular reason for this specific MSRV policy, but it's better
than nothing, since this will allow us to always update without
thinking about it.
See fish-shell#11961 (comment)

I didn't find a good way to add ~/.cargo/bin to $PATH only for
fishuser, so hardcode it for all users for now.  The default rustup
behavior (source it in ~/.bashrc) only works for interactive shells,
so it doesn't work in CI.

I updated the images manually for now, because
I'm not sure I want to test on master (see
fish-shell#11884 and
fish-shell#11961 (comment))

	sed -i '/if: github.repository_owner/d' .github/workflows/build_docker_images.yml
	git commit
	# Upload new docker images.
	repo_owner=krobelus
	git push $repo_owner HEAD:tmp
	gh --repo=$repo_owner/fish-shell \
	    workflow run --ref=tmp \
	    .github/workflows/build_docker_images.yml
	# https://github.com/$repo_owner/fish-shell/actions/workflows/build_docker_images.yml
	sleep 3m
	# Enable Cirrus CI on fork.
	sed -i "s/OWNER == 'fish-shell'/OWNER == '$repo_owner'/g" .cirrus.yml
	git commit
	git push $repo_owner HEAD:tmp

Part of fish-shell#11961
Opt-in because we don't want failures not related to local changes,
see d93fc5e (Revert "build_tools/check.sh: check that stable rust
is up-to-date", 2025-08-10).

For the same reason, it's not currently checked by CI, though we
could definitely have "renovatebot" do this in future.
Comment on lines +11 to +67
check_dependency_versions=false
if [ "${FISH_CHECK_DEPENDENCY_VERSIONS:-false}" != false ]; then
check_dependency_versions=true
fi

if $check_dependency_versions; then
command -v curl
command -v jq
command -v rustup
sort --version-sort </dev/null
# Check that we have latest stable.
if rustup check | grep ^stable- | grep 'Update available'; then
exit 1
fi
# Check that GitHub CI uses latest stable Rust version.
stable_rust_version=$(rustc --version | cut -d' ' -f2)
stable_rust_version=${stable_rust_version%.*}
grep -q "(stable) echo $stable_rust_version ;;" \
"$(project-root)/.github/actions/rust-toolchain/action.yml"

# Check that GitHub CI's MSRV is the Rust version available Debian stable.
debian_stable_codename=$(
curl -fsS https://ftp.debian.org/debian/dists/stable/Release |
grep '^Codename:' | cut -d' ' -f2)
debian_stable_rust_version=$(
curl -fsS https://sources.debian.org/api/src/rustc/ |
jq -r --arg debian_stable_codename "$debian_stable_codename" '
.versions[] | select(.suites[] == $debian_stable_codename) | .version' |
sed 's/^\([0-9]\+\.[0-9]\+\).*/\1/' |
sort --version-sort |
tail -1)
grep -q "(msrv) *echo $debian_stable_rust_version ;;" \
"$(project-root)/.github/actions/rust-toolchain/action.yml"

# Check that Cirrus CI uses the latest minor version of Alpine Linux.
alpine_latest_version=$(
curl -fsS "https://registry.hub.docker.com/v2/repositories/library/alpine/tags?page_size=10" \
| jq -r '.results[].name' | grep '^[0-9]\+\.[0-9]\+$' |
sort --version-sort |
tail -1)
grep -qFx "FROM alpine:$alpine_latest_version" docker/alpine.Dockerfile

# Check that Cirrus CI uses the oldest version of Ubuntu that's not EOL.
ubuntu_oldest_alive_version=$(
today=$(date --iso-8601)
curl -fsS https://endoflife.date/api/ubuntu.json |
jq -r --arg today "$today" '
.[]
| select(.eol >= $today)
| "\(.cycle)"
' |
sort --version-sort |
head -1
)
grep -qFx "FROM ubuntu:$ubuntu_oldest_alive_version" docker/ubuntu-oldest-supported.Dockerfile
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should switch to Renovate straight away.

The upside is that it can generate PRs with automatic updates.
Possible downside is the extra notifications from all these PRs but I guess that's fine.

> give me configuration for renovatebot that does more or less the equivalent as lines
  16 to 66 from build_tools/check.sh

● Read(build_tools/check.sh)
  ⎿  Read 60 lines (ctrl+r to expand)

● Here's a Renovate configuration that does the equivalent of the dependency checking
  in lines 16-66:

  {
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": ["config:recommended"],
    "regexManagers": [
      {
        "fileMatch": ["^\\.github/actions/rust-toolchain/action\\.yml$"],
        "matchStrings": [
          "\\(stable\\) echo (?<currentValue>\\d+\\.\\d+) ;;"
        ],
        "depNameTemplate": "rust-stable",
        "datasourceTemplate": "github-releases",
        "packageNameTemplate": "rust-lang/rust"
      },
      {
        "fileMatch": ["^\\.github/actions/rust-toolchain/action\\.yml$"],
        "matchStrings": [
          "\\(msrv\\) \\*?echo (?<currentValue>\\d+\\.\\d+) ;;"
        ],
        "depNameTemplate": "rust-debian-stable",
        "datasourceTemplate": "custom.debian-rust",
        "packageNameTemplate": "rustc"
      },
      {
        "fileMatch": ["^docker/alpine\\.Dockerfile$"],
        "matchStrings": [
          "FROM alpine:(?<currentValue>\\d+\\.\\d+)"
        ],
        "depNameTemplate": "alpine",
        "datasourceTemplate": "docker",
        "packageNameTemplate": "alpine"
      },
      {
        "fileMatch": ["^docker/ubuntu-oldest-supported\\.Dockerfile$"],
        "matchStrings": [
          "FROM ubuntu:(?<currentValue>\\d+\\.\\d+)"
        ],
        "depNameTemplate": "ubuntu-oldest-supported",
        "datasourceTemplate": "custom.ubuntu-eol",
        "packageNameTemplate": "ubuntu"
      }
    ],
    "customDatasources": {
      "debian-rust": {
        "defaultRegistryUrlTemplate": "https://sources.debian.org/api/src/rustc/",
        "transformTemplates": [
          "{\"releases\": [{\"version\": \"${value}\"}]}"
        ]
      },
      "ubuntu-eol": {
        "defaultRegistryUrlTemplate": "https://endoflife.date/api/ubuntu.json",
        "transformTemplates": [
          "{\"releases\": [${#each (filter releases 'eol >= \"${now}\"')}}{\"version\":
   \"${cycle}\"}${#unless @last},{/unless}${/each}]}"
        ]
      }
    }
  }

@krobelus krobelus closed this in 4f48797 Oct 19, 2025
@krobelus krobelus added this to the fish 4.2 milestone Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant