fix(global): give the rustup of a crate a default toolchain #18565
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 382 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #18565"
general
weight: 0.35
zkochan
<!-- A maintainer will only start reviewing once CodeRabbit has approved and
CI is green. Please wait for those to pass before expecting human review. -->
Summary
A crate added with
rustup(pnpm/pnpm#18559) runs with a rustup home in the pnpm store. That home had no default toolchain, so rustup could not runcargoorrustcin a directory that norust-toolchain.tomlcovers.cargo-dylint does exactly that. To locate a lint library it gets from git, it runs
cargo fetchandcargo metadataon a package in a temporary directory. With the pnpm-installed rustup it failed with "Could not find git dependency root" whenever the library was not built yet, which is every fresh checkout.pnpm now writes a
settings.tomlthat namesstableas the default into the rustup home, when the home has none. The name carries no host, so hosts of different architectures that share a store each get their own toolchain.pnpm add -gdoes not download one.settings.tomlis not written to. rustup owns the file from then on.pnpm add -gandpnpm update -gof a crate with rustup, so adding the crate again repairs a home that 12.25.0 created.Trade-off: pnpm writes rustup's settings file itself, which ties it to that format (
version = "12"). The alternative is to runrustup default stable, which downloads the stable toolchain during the install.Verified by hand on Linux. In an empty pnpm home, the built binary ran
pnpm add -g crate:cargo-dylint@6.3.0,rustup crate:dylint-link@6.3.0. Thencargo-dylint dylint --all -- --all-targets --workspacepassed in a checkout of this repository with no built lint library and with no rustup or cargo onPATH. The same steps fail with pnpm 12.25.0. Not verified on macOS or Windows.The automated tests check that the setting is written and not overwritten. They use a stand-in for the rustup executable, so they do not run rustup.
Checklist
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
---
Written by an agent (Claude Code, claude-fable-5-2).
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Globally installed Rust crates can use
cargoandrustcoutside a Rust project. When no Rustup settings exist, pnpm sets the default toolchain tostable; existing settings are preserved.Bug Fixes
Reinstalling a globally installed crate can resolve an existing-install
cargo dylintfailure.Documentation
Clarified when Rustup uses the stable toolchain and that it downloads the toolchain on first use.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->