Skip to content

Confusing error message for re-exported types. Maybe show "aka"? #29728

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
jhasse opened this issue Nov 9, 2015 · 3 comments
Closed

Confusing error message for re-exported types. Maybe show "aka"? #29728

jhasse opened this issue Nov 9, 2015 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@jhasse
Copy link
Contributor

jhasse commented Nov 9, 2015

I'm doing the following:

        gl::load_with(|s| window.get_proc_address(s));

which gives me

error: mismatched types:
 expected `*const libc::c_void`,
    found `*const ()`

So I added a cast:

gl::load_with(|s| window.get_proc_address(s) as *const libc::c_void);

This results in:

error: mismatched types:
 expected `*const libc::c_void`,
    found `*const libc::types::common::c95::c_void`

And now I'm lost :D Why does it say it found *const libc::types::common::c95::c_void? I didn't write that. Apparently there's an older version of libc where libc::c_void is a re-export of the long type (durka42 told me that on IRC).

This is what I would expect the error message to look like:

error: mismatched types:
 expected `*const libc::c_void`,
    found `*const libc::c_void` aka `*const libc::types::common::c95::c_void`

This would still be a little bit confusing. Maybe include the version numbers somehow?

error: mismatched types:
 expected `*const libc::c_void` with libc 0.2,
    found `*const libc::c_void` aka `*const libc::types::common::c95::c_void` with libc 0.1
@steveklabnik
Copy link
Member

This should be a duplicate of another issue, but I can't seem to find it at the moment.

The only reason we don't do "aka" right now is that we don't actually have that information. I do believe that newer compilers have the version number though. @Manishearth was that you?

@Manishearth
Copy link
Member

No, I just made it mention that there may be two crates in scope when it hits the error. rust doesn't know about crate versions, though it can attempt to extract it from the --extern flags cargo passes to it.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 11, 2015
@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

I'm going to close in favor of #17164 which is the "canonical" issue for diagnostics needing to print out type alias information.

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

4 participants