← Back to Pull requests

fix(global): give the rustup of a crate a default toolchain #18565

Closed
unknown closed this pull request without merging on Nov 29, 2026 21:17 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 20:46 UTC
Author

<!-- 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 run cargo or rustc in a directory that no rust-toolchain.toml covers.

cargo-dylint does exactly that. To locate a lint library it gets from git, it runs cargo fetch and cargo metadata on 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.toml that names stable as 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.

  • rustup downloads the toolchain the first time it is used, so pnpm add -g does not download one.

  • A home that already has a settings.toml is not written to. rustup owns the file from then on.

  • The setting is written on every pnpm add -g and pnpm update -g of 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 run rustup 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. Then cargo-dylint dylint --all -- --all-targets --workspace passed in a checkout of this repository with no built lint library and with no rustup or cargo on PATH. 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

  • Added a changeset (pnpm changeset) if this PR changes any published

  • package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

  • Updated the documentation if needed.
  • ---
    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 cargo and rustc outside a Rust project. When no Rustup settings exist, pnpm sets the default toolchain to stable; existing settings are preserved.
    Bug Fixes
    Reinstalling a globally installed crate can resolve an existing-install cargo dylint failure.
    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 -->

    Diff: 382 lines (+286 / -96) across 4 files Reviewer: zkochan Review duration: 31m
    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
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.0% · Safe to merge
    17.0%
    Repository