Skip to content

Type errors in macros have poor spans #38771

Description

@Mark-Simulacrum

For example, in this code, it's hard to tell which part of the inputs to the macro has the wrong type. This is obviously a reduced example, but I've seen the same problem in real code.

I suspect this might be a duplicate issue, but couldn't find anything...

fn main() {
    assert_eq!(10u64, 10usize);
}

provides:

rustc 1.16.0-nightly (4ecc85beb 2016-12-28)
error[E0308]: mismatched types
 --> <anon>:2:5
  |
2 |     assert_eq!(10u64, 10usize);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
  |
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions