-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(rust-toolchain): Add rust-toolchain manager
#38554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
09a0af0 to
d42b63f
Compare
rust-toolchain manager
a86b8a3 to
cbfb1ab
Compare
8afae48 to
7682dc7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
128925c to
bc87549
Compare
|
alright, the improvements from #38554 (comment) have all been implemented, so I think this is ready for review now :) /cc @jamietanna |
|
@viceice let me know if there is anything I can do to make this easier to review. I'm happy to spilt it up into more digestible chunks :) |
bc87549 to
dfdd76d
Compare
|
Hi there, Please do not post comments like: "Any update on this?" or "When will this be fixed?". If you're asking because you want to know if there's been some progress, then please know that we work in the open in this repo. If there was an update to this Discussion or Issue, you would see it already. So please don't ask "just in case". If you're asking because you want to get our attention, then please don't do that either. It wastes maintainer time and pollutes the repo. You're welcome to fix issues yourself, hire someone to help you, or wait for someone else to do the work. You're not welcome to post the equivalent of "Hey, someone else should really do something about this". If you are a paying Mend.io customer, contact your support or customer success representative, and tell them this issue is important to you. We expect everyone to follow these rules, no matter if you use the free tiers, or are a paying Mend customer. Please read our Code of Conduct, how we prioritize work to learn more about how we prioritize what to work on. Thanks, the Renovate team |
|
Hi there, This is intended as a polite, automated request that users avoid We know it might be common elsewhere but we participate in hundreds of discussions a week and would need to turn off GitHub mobile notifications if we were mentioned in every one. As a general rule, we will read and respond to all discussions in this repository, so there is no need to mention us. Thanks, the Renovate team |
|
Hey, we have seen this, it's on the TODO list to take a look, no need to drop us @-mentions :) |
|
sorry about that! wasn't sure it had been seen since there had been no reaction so far 😅 |
dfdd76d to
0e1ade5
Compare
|
FWIW I recommend reviewing this PR commit-by-commit. The full diff can be a bit scary due to its size, but I made sure to structure the commits in a way that they build the full functionality step by step and that they could be merged at any step in between if parts of the branch turn out to be controversial :) |
3a66185 to
7693a59
Compare
7693a59 to
a3bf482
Compare
| import type { GetReleasesConfig, Release, ReleaseResult } from '../types'; | ||
|
|
||
| export class RustNightlyDatasource extends Datasource { | ||
| static readonly id = 'rust-nightly'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to name it rust-version to align with our other tool version datasources.
it should also split of this PR to be merged first after general feedback was incorporated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem with rust-version is that the data source only contains the nightly versions but not the beta or stable releases.
what do you think about rust-nightly-version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should also split of this PR to be merged first
I opened a dedicated PR for the rust-nightly-version data source (and corresponding versioning scheme): #39260
New package manager questionnaire
Did you read our documentation on adding a package manager?
Basics
What's the name of the package manager?
Rust Toolchain (
rust-toolchain)What language(s) does this package manager support?
It is for the Rust programming language, but the relevant configuration file is in TOML.
How popular is this package manager?
rustup is used by the majority of Rust users, though not everyone is using it with a
rust-toolchain.tomlfile. It is however fairly popular for embedded developers that often rely on nightly features and is used there to pin down nightly release versions to a specific date.Does this language have other (competing?) package managers?
cargo handles the dependencies of Rust projects, but not the Rust toolchain version itself, so this shouldn't be seen as competition.
What are the big selling points for this package manager?
Previously, people could use the regex manager with the GitHub releases datasource to achieve something similar, but were limited to pinning stable releases. With this dedicated implementation we support:
1.90.0→2.0.0(major version updates)1.90.0→1.91.0(minor version updates)1.90.0→1.90.1(patch version updates)nightly-2025-10-10→nightly-2025-10-11(nightly version updates)With
rangeStrategy: replace:1.90→2.0(major range updates)1.90→1.91(minor range updates)With
rangeStrategy: pin:1.90→1.90.0(range pinning)stable→1.90.0(stable channel pinning)nightly→nightly-2025-10-11(nightly channel pinning)Detecting package files
What kind of package files, and names, does this package manager use?
rust-toolchain.toml(and the legacyrust-toolchain)Which
managerFilePatternspattern(s) should Renovate use?/(^|/)rust-toolchain(\.toml)?$/Do many users need to extend the
managerFilePatternspattern for custom file names?Is the
managerFilePatternspattern going to get many "false hits" for files that have nothing to do with package management?No
Parsing and Extraction
Can package files have "local" links to each other that need to be resolved?
No
Package file parsing method
The package files should be:
Which format/syntax does the package file use?
The legacy format uses a plain-text channel specifier, but is only supported for the legacy filename (
rust-toolchain).rust-toolchain.tomlonly supports the TOML format.How should we parse the package files?
Does the package file have different "types" of dependencies?
I chose to use
depType: toolchainwhich makes the following work:{ "packageRules": [ { "matchDepTypes": ["toolchain"], "rangeStrategy": "pin" } ] }List all the sources/syntaxes of dependencies that can be extracted
I'm not sure I understand this question 🤔
The parser extracts the
toolchain.channelfield from the TOML file.Describe which types of dependencies above are supported and which will be implemented in future
Only the
channelfield is supported as adepType: toolchaindependency.Versioning
What versioning scheme does the package file(s) use?
It's complicated... 😅
https://rust-lang.github.io/rustup/overrides.html#channel specifies the supported values for this field:
Since supporting all of them in a single versioning scheme seemed fairly complicated, I chose two create two new versioning schemes:
rust-toolchainandrust-toolchain-nightlyThe former supports
stable,x.y.zandx.yspecifiers. The latter supportsnightlyandnightly-YYYY-MM-DDspecifiers.Does this versioning scheme support range constraints, like
^1.0.0or1.x?^1.0.0or1.x), provide details.Yes, but only in the form of the
stableandnightlyconstants.Lookup
Is a new datasource required?
A new
rust-nightlydatasource is added by this pull request, which queries https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rust.json for the latest available nightly versions.For stable releases we use the existing GitHub releases datasource.
Unfortunately https://github.com/rust-lang/rust/releases only contains the stable releases, so we have no way of supporting beta releases.
Will users want (or need to) set a custom host or custom registry for Renovate's lookup?
Where can Renovate find the custom host/registry?
Are there any constraints in the package files that Renovate should use in the lookup procedure?
v3.x), provide details.Will users need the ability to configure language or other constraints using Renovate config?
Artifacts
Does the package manager use a lock file or checksum file?
Package manager cache
Does the package manager use a cache?
Only the datasource is using a 60min cache.
Generating a lockfile from scratch
Renovate can perform "lock file maintenance" by getting the package manager to generate a lockfile from scratch.
Can the package manager generate a lockfile from scratch?
Other
What else should we know about this package manager?
This pull request addresses:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
I used Claude Code for the initial discovery, writing down an implementation plan, and for a large portion of the implementation. I did however review each individual step to the best of my abilities and feel fairly confident in the implementation.
I performed a bunch of manual integration testing by running renovate locally. You can see (some of) the results at https://github.com/Turbo87/renovate-rust-test/pulls?q=is%3Apr.