Skip to content
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

Fix up the spans for type errors #1

Open
chris-morgan opened this issue Nov 12, 2014 · 0 comments
Open

Fix up the spans for type errors #1

chris-morgan opened this issue Nov 12, 2014 · 0 comments

Comments

@chris-morgan
Copy link

Compare assert and assert_ng when there is a type error, and you’ll see assert_ng isn’t faring well.

assert_ng:

a.rs:12:5: 12:25 error: mismatched types: expected `int`, found `&int` (expected int, found &-ptr)
a.rs:12     assert_ng!(a == &a);
            ^~~~~~~~~~~~~~~~~~~~
a.rs:1:1: 14:1 note: in expansion of assert_ng!
a.rs:12:5: 12:25 note: expansion site

assert:

a.rs:13:18: 13:20 error: mismatched types: expected `int`, found `&int` (expected int, found &-ptr)
a.rs:13     assert!(a == &a);
                         ^~
<std macros>:1:1: 12:2 note: in expansion of assert!
a.rs:13:5: 13:22 note: expansion site

Using quote_expr just isn’t going to cut it for getting it perfect; it’s going to need a manually constructed AST with spans carefully arranged in some way to get the correspondence correct.

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

No branches or pull requests

1 participant