Improved the test error messages when 'rustc -V' fails - #17108
Merged
weihanglo merged 1 commit intoJun 17, 2026
Conversation
epage
reviewed
Jun 16, 2026
| if exit_code != Some(0) { | ||
| let stdout = std::str::from_utf8(&output.stdout).unwrap_or("<invalid utf8>"); | ||
| let stderr = std::str::from_utf8(&output.stderr).unwrap_or("<invalid utf8>"); | ||
| let extra = if exit_code.map(|c| c as u32) == Some(3221225495) { |
Contributor
There was a problem hiding this comment.
I believe this is generally written in hex
Suggested change
| let extra = if exit_code.map(|c| c as u32) == Some(3221225495) { | |
| let extra = if exit_code.map(|c| c as u32) == Some(0xC0000017) { |
Contributor
There was a problem hiding this comment.
I dislike having the constant but unsure if it is worth pulling in windows-sys to get the constant
Member
There was a problem hiding this comment.
Could we have a comment link to the official doc about this exit code?
Member
Author
There was a problem hiding this comment.
I updated to 0xC0000017. I felt pulling in windows-sys was a bit overkill for a slightly better error message in what I expect to be a rare failure.
Also it seems like this error code is not well documented.
I can see many blog posts about "how to fix windows booting" that mention this error code but could not track down any official documentation on this code 😅
ranger-ross
force-pushed
the
better-cargo-test-rustc-failure
branch
from
June 17, 2026 02:03
d269d1e to
dfa3c47
Compare
ranger-ross
force-pushed
the
better-cargo-test-rustc-failure
branch
from
June 17, 2026 02:05
dfa3c47 to
855c844
Compare
weihanglo
approved these changes
Jun 17, 2026
weihanglo
enabled auto-merge
June 17, 2026 02:06
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Jun 17, 2026
Update cargo submodule 7 commits in fe63976b245b8a649c3f2949bf89fdc307bfbae4..598ab48ec328e3e4f5e4e373d8df7264bc8e27cd 2026-06-11 09:17:57 +0000 to 2026-06-17 02:39:50 +0000 - Improved the test error messages when 'rustc -V' fails (rust-lang/cargo#17108) - test(install): `cargo install` --path honors MSRV (rust-lang/cargo#17102) - feat(trim-paths): emit `CARGO_TRIM_PATHS_REMAP` for build.rs (rust-lang/cargo#17104) - Add funding links (rust-lang/cargo#17103) - fix(diag): Give diagnostics the same display path behavior as rustc (rust-lang/cargo#17101) - refactor: remove cargo-util-terminal from bump-check exclusions (rust-lang/cargo#17098) - fix(diag): Report all errors, in order (rust-lang/cargo#17095)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
While debugging the build issues in rust-lang/rust#155439 I was running into some issues where
rustc -Vwould fail due to windows path limits.When happens the error message is not super helpful.
I added some panic messages which replace the currently less helpful
help:line.I also special cased Windows error code
3221225495with a dedicated error message since is its not super obvious what is happening I hope to avoid other having to go through the pain of debugging this.How to test and review this PR?
I tested against the changes in rust-lang/rust#155439 but you could also probably override the rustc on the PATH with something that always returns an error status code.
r? @weihanglo