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

External macro invocation errors print internals but not invocation site #19243

Closed
arielb1 opened this issue Nov 23, 2014 · 5 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@arielb1
Copy link
Contributor

arielb1 commented Nov 23, 2014

The code

fn main() {}
// ...
// lots of code
// ...
fn some_random_function() {
    // lots of code here
    let unused = vec![];
    // even more code
}

gives an error message which does not even hint about the error's location:

<std macros>:5:9: 5:22 error: unable to infer enough type information about `_`; type annotations required
<std macros>:5         xs.into_vec()
                       ^~~~~~~~~~~~~
<std macros>:1:1: 8:2 note: in expansion of vec!
<anon>:4:5: 4:12 note: expansion site

Which makes finding the offending statement require quite a bit of effort.

@sfackler
Copy link
Member

The last line of the message has the location of the offending statement.

@kmcallister kmcallister added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 23, 2014
@steveklabnik
Copy link
Member

Triage: no change. This does point at where the error is, but it's still a worse error than we could give.

@nagisa
Copy link
Member

nagisa commented Jan 19, 2016

Duplicate of #25633. Duping into a newer issue, because the other issue has more descriptive title and shows the underlying issue of compiler being unable to figure out the generic parameters for calls.

@nagisa nagisa closed this as completed Jan 19, 2016
@arielb1
Copy link
Contributor Author

arielb1 commented Jan 25, 2016

Not that sure of it - the error coming out of a vec![] macro wasn't my problem, more that we span the interior of vec![] rather than the actual source.

@arielb1 arielb1 reopened this Jan 25, 2016
@huonw huonw added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Jan 25, 2016
@huonw huonw changed the title Terrible error message with an unused vec![] External macro invocation errors print internals but not invocation site Jan 25, 2016
@keeperofdakeys
Copy link
Contributor

On rust 1.13, this now shows the following:

error[E0282]: unable to infer enough type information about `_`
 --> temp.rs:2:16
  |
2 |   let unused = vec![];
  |                ^^^^^^ cannot infer type for `_`
  |
  = note: type annotations or generic parameter binding required
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error

This now points at the right span, and any improvement of the error message would probably be part a of #25633. So this issue can probably be closed.

@arielb1 arielb1 closed this as completed Feb 9, 2017
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

7 participants