Skip to content

E0023 should have smaller, more targeted spans #86307

New issue

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

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

Already on GitHub? # to your account

Closed
estebank opened this issue Jun 14, 2021 · 0 comments · Fixed by #88123
Closed

E0023 should have smaller, more targeted spans #86307

estebank opened this issue Jun 14, 2021 · 0 comments · Fixed by #88123
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

Currently, when a tuple pattern has a different number of fields than a tuple variant, the output is like the following:

error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field
   --> compiler/rustc_middle/src/ty/print/pretty.rs:634:27
    |
634 |                         | ty::PredicateKind::ImplicitSizedTrait(pred, _) =
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 field, found 2
    | 
   ::: compiler/rustc_middle/src/ty/mod.rs:440:5
    |
440 |     ImplicitSizedTrait(TraitPredicate<'tcx>),
    |     ---------------------------------------- tuple variant defined here

Ideally, the primary span would be for the individual fields, with a secondary span pointing at the pattern path. As a stretch goal, when pointing at the definition we'd point at the fields in the same way, instead of the whole variant (but this isn't absolutely necessary).

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-papercut Diagnostics: An error or lint that needs small tweaks. labels Jun 14, 2021
@camelid camelid self-assigned this Jun 14, 2021
@JohnTitor JohnTitor added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 1, 2021
camelid added a commit to camelid/rust that referenced this issue Aug 17, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Aug 26, 2021
…tebank

Make spans for tuple patterns in E0023 more precise

As suggested in rust-lang#86307. Closes rust-lang#86307.

r? `@estebank`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Aug 26, 2021
…tebank

Make spans for tuple patterns in E0023 more precise

As suggested in rust-lang#86307. Closes rust-lang#86307.

r? ``@estebank``
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Aug 26, 2021
…tebank

Make spans for tuple patterns in E0023 more precise

As suggested in rust-lang#86307. Closes rust-lang#86307.

r? ```@estebank```
@bors bors closed this as completed in 8aa46e5 Aug 27, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants