Skip to content

Error without line number (macros, deriving type) #33949

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

Closed
dhardy opened this issue May 29, 2016 · 4 comments
Closed

Error without line number (macros, deriving type) #33949

dhardy opened this issue May 29, 2016 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@dhardy
Copy link
Contributor

dhardy commented May 29, 2016

Try compiling this:

fn main() {
    let v = vec![];
}

The error message never mentions a line number outside of the macro.

error: unable to infer enough type information about `_`; type annotations or generic parameter binding required [--explain E0282]
 --> <std macros>:3:1
3 |> < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * )
  |> ^^^^^^^^^^^^^^^^^^^^^
<std macros>:3:1: 3:22: note: in this expansion of vec! (defined in <std macros>)

error: aborting due to previous error
playpen: application terminated with error code 101
@nagisa
Copy link
Member

nagisa commented May 29, 2016

I feel like we had an issue about it already, but cannot find it.

cc @jonathandturner @nikomatsakis

@nagisa nagisa added the A-diagnostics Area: Messages for errors, warnings, and lints label May 29, 2016
@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum
Copy link
Member

Today, this works and provides the expected line numbers.

error[E0282]: type annotations needed
 --> test.rs:2:13
  |
2 |     let v = vec![];
  |         -   ^^^^^^ cannot infer type for `T`
  |         |
  |         consider giving `v` a type
  |
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error(s)

@sophiajt
Copy link
Contributor

sophiajt commented Jun 5, 2017

Agreed we're (considerably) better than where we were.

I do wonder if we could improve it a bit more, too. A new user might look at this and go "what T?" Not sure if it warrants its a separate issue, just throwing the idea out there.

@Mark-Simulacrum
Copy link
Member

Yeah, we are discussing the what T to some extent on #25633.

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
Projects
None yet
Development

No branches or pull requests

5 participants