Skip to content

feat(toolchain): improve error reporting in rustc_version(), pt. 1 - #5225

Open
rami3l wants to merge 7 commits into
rust-lang:mainfrom
rami3l:feat/rustc-version-error-2
Open

rami3l wants to merge 7 commits into
rust-lang:mainfrom
rami3l:feat/rustc-version-error-2

Conversation

@rami3l

@rami3l rami3l commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Related to #3607, replaces #4741.

@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch 3 times, most recently from 2f0c5e4 to a94b6b4 Compare November 17, 2026 16:49
@rami3l
rami3l marked this pull request as ready for review November 17, 2026 17:46
@rami3l
rami3l requested review from ChrisDenton and djc November 17, 2026 17:46
Comment thread src/toolchain.rs Resolved
Comment thread src/toolchain.rs Resolved
@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch from a94b6b4 to 345b114 Compare November 18, 2026 14:34
@rustbot

This comment has been minimized.

@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch 4 times, most recently from adecfd7 to 2f0643e Compare November 18, 2026 14:57
@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch from 2f0643e to 2a6a997 Compare November 18, 2026 15:34
@rustbot

rustbot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Copilot AI left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A custom rustc wrapper’s background helper can keep stderr open after the wrapper fails, causing stderr collection to block indefinitely and bypass the ten-second timeout.

1 open issue
What changed in this PR

This PR improves rustc_version() diagnostics so rustup reports why compiler version detection failed, addressing #3607 and replacing #4741.

Changes:

  • Reports command-creation errors, launch failures, and compiler stderr or exit status.
  • Uses Cow<'static, str> for version strings throughout update reporting.
  • Adds CLI tests for missing compilers, recursion limits, nonzero exits, and permission errors.
File Description
tests/​suite/​cli_rustup.rs Adds verbose toolchain error-reporting tests.
src/​toolchain.rs Expands version diagnostics and extracts first-line reading.
src/​install.rs Adapts stored previous versions to Cow.
src/​dist/​mod.rs Updates previous date/version storage for the new return type.
src/​cli/​self_update.rs Wraps the previous rustup version in Cow::Owned.
src/​cli/​common.rs Adapts channel update output to Cow version strings.

Review effort: Balanced

View changes since this review

Comment thread src/toolchain.rs Outdated
Comment on lines +300 to +304
match read_first_line(
child
.stderr
.expect("Child::stderr requested but not present"),
) {

@rami3l rami3l Nov 18, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It looks like there is a pre-existing issue in read_first_line() even with the stdout part. I'm retracting the stderr-capturing part of the patch for now and hoping to address that properly in a later PR.

Update: Split into #5228.

@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch 2 times, most recently from 023c1a5 to 59c58d5 Compare November 18, 2026 16:59
@rami3l rami3l changed the title feat(toolchain): improve error reporting in rustc_version() feat(toolchain): improve error reporting in rustc_version(), pt. 1 Nov 18, 2026
@rami3l
rami3l requested a review from djc November 18, 2026 17:10
…ils with non-zero

Co-authored-by: bogay <pojay11523@gmail.com>
@rami3l
rami3l force-pushed the feat/rustc-version-error-2 branch from dd49f5a to 9800d85 Compare November 18, 2026 17:26

This branch has not been deployed

No deployments
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.

4 participants