Skip to content

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

@jhasse

Description

@jhasse

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions