Skip to content

[draft] Do not emit multiple independent notes on linker errors#151345

Open
estebank wants to merge 4 commits intorust-lang:mainfrom
estebank:codegen_errors
Open

[draft] Do not emit multiple independent notes on linker errors#151345
estebank wants to merge 4 commits intorust-lang:mainfrom
estebank:codegen_errors

Conversation

@estebank
Copy link
Contributor

No description provided.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

r? @jdonszelmann

rustbot has assigned @jdonszelmann.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@Kivooeo
Copy link
Member

Kivooeo commented Jan 18, 2026

r? me

i'd highly appreciate some context or elaboration on changes, like, why do we want to change it and/or what's bad about current approach (it's fine if you provide it later, no rush here)

oh, and also it might take some time, i will try to take a look as soon as possible but review time might be up like to day or two

and if it's not yet ready to be reviewed (i assume it isn't because of draft tag) could you give me some sort of signal when it's ready

@rustbot rustbot assigned Kivooeo and unassigned jdonszelmann Jan 18, 2026
@estebank
Copy link
Contributor Author

estebank commented Jan 19, 2026

@Kivooeo right now I'm just trying to see if these errors are being tested anywhere (while not with access to a windows machine to do so), hence the early publication of the PR.

I noticed this thread where the output was

error: linker `link.exe` not found
  |
  = note: program not found

note: the msvc targets depend on the msvc linker but `link.exe` was not found

note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.

note: VS Code is a different product, and is not sufficient.

error: could not compile `Fundamentals` (bin "Fundamentals") due to 1 previous error

which doesn't really follow the "grammar" of our errors, by having related information rendered as independent notes.

The output should instead be closer to

error: linker `link.exe` not found
  |
  = note: program not found
  = note: the msvc targets depend on the msvc linker but `link.exe` was not found
  = note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option
  = note: you can obtain "Build Tools for Visual Studio" from <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2026>
  = note: VS Code is a different product, and is not sufficient

Initially just wanted to add the link, but as I looked around in that file I noticed that there were two similar cases using the same, IMO, bad strategy. So I tried to unify them. I'll update the PR description once 1) I've validated that these are being tested at all (I don't think they are) and 2) I've cleaned it up further.

@jyn514
Copy link
Member

jyn514 commented Jan 19, 2026

I have a windows machine I can use to test this if that’s helpful.

@jyn514
Copy link
Member

jyn514 commented Jan 19, 2026

I believe windows also has free ISOs on their website, which you can run in a VM.

@estebank
Copy link
Contributor Author

@jyn514 yes, I'll try to replicate these cases manually. I don't think we are testing them :-/

It is about half a dozen individual cases, not all of which I'm confident I can trigger :)

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 5, 2026

☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts.

@ChrisDenton
Copy link
Member

ChrisDenton commented Feb 6, 2026

@jyn514 yes, I'll try to replicate these cases manually. I don't think we are testing them :-/

It is about half a dozen individual cases, not all of which I'm confident I can trigger :)

These are hard to test in CI due to relying (in part) on how (or if) Visual Studio is set up and whether or not msys2's tools are in PATH. I think we can do better by setting environment variables to change what's in PATH and to manipulate find-msvc-tools in to behaving in different ways. But I don't think that would be perfect either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants