Skip to content

Tweak spans providing type context on errors when involving macros #145227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2025

Conversation

estebank
Copy link
Contributor

Do not point at macro invocation multiple times when we try to add span labels mentioning what type each expression has, which is unnecessary when the error is at a macro invocation.

Do not point at macro invocation which expands to an inference error. Avoid the following:

```
error[E0308]: mismatched types
  --> $DIR/does-not-have-iter-interpolated.rs:12:5
   |
LL |     quote!($($nonrep)*);
   |     ^^^^^^^^^^^^^^^^^^^
   |     |
   |     expected `HasIterator`, found `ThereIsNoIteratorInRepetition`
   |     expected due to this
   |     here the type of `has_iter` is inferred to be `ThereIsNoIteratorInRepetition`
```
@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
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

@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 Aug 10, 2025
@joshtriplett
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 11, 2025

📌 Commit 48816e7 has been approved by joshtriplett

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 11, 2025
bors added a commit that referenced this pull request Aug 11, 2025
Rollup of 7 pull requests

Successful merges:

 - #143949 (Constify remaining traits/impls for `const_ops`)
 - #144330 (document assumptions about `Clone` and `Eq` traits)
 - #144350 (std: sys: io: io_slice: Add UEFI types)
 - #144558 (Point at the `Fn()` or `FnMut()` bound that coerced a closure, which caused a move error)
 - #145149 (Make config method invoke inside parse use dwn_ctx)
 - #145227 (Tweak spans providing type context on errors when involving macros)
 - #145228 (Remove unnecessary parentheses in `assert!`s)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 44c9ece into rust-lang:master Aug 11, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 11, 2025
rust-timer added a commit that referenced this pull request Aug 11, 2025
Rollup merge of #145227 - estebank:tweak-inference-span, r=joshtriplett

Tweak spans providing type context on errors when involving macros

Do not point at macro invocation multiple times when we try to add span labels mentioning what type each expression has, which is unnecessary when the error is at a macro invocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants