Skip to content

Conversation

dpaoliello
Copy link
Contributor

The Rust Compiler needs to find rc.exe from the Windows SDK, which it does by finding the linker, then searching through the PATH env var to see if rc.exe exists anywhere there:
https://github.com/rust-lang/rust/blob/364da5d88d772fa40fb20353443595385443ac25/compiler/rustc_windows_rc/src/lib.rs#L141-L158

Instead, we can have find-msvc-tools search the Windows SDK paths for tools if that tool is not found in the VC path.

Comment on lines 1004 to 1005
.next()
.or_else(|| Some((sdk_info.find_tool(tool)?, None)))
.map(|(tool_path, host)| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
.next()
.or_else(|| Some((sdk_info.find_tool(tool)?, None)))
.map(|(tool_path, host)| {
.chain(iter::once(|| Some((sdk_info.find_tool(tool)?, None))))
.find_map(|(tool_path, host)| {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clippy prefers map + next, so following that recommendation.

Copy link
Collaborator

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

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

Thank you!

@NobodyXu NobodyXu merged commit ac2192c into rust-lang:main Sep 16, 2025
77 checks passed
@dpaoliello dpaoliello deleted the sdktools branch September 16, 2025 15:46
@dpaoliello
Copy link
Contributor Author

If you create a release for find-msvc-tools, then I can switch rustc over to using it (without the cc bump)

@NobodyXu
Copy link
Collaborator

Unfortunately our release pipeline would create release for cc and find-msvc-tools

It is scheduled to run on this Friday, so if you want it befre Friday, I can cut an early release of find-msvc-tools and cc for you

@dpaoliello
Copy link
Contributor Author

Friday is fine: I'm in no rush

@NobodyXu
Copy link
Collaborator

@dpaoliello new release is cut!

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.

2 participants