Skip to content

Improve error messages involving type aliases #17164

Open
@nodakai

Description

@nodakai
extern crate libc;
fn main() {
    let a: libc::ssize_t = 0;
    let () = a;
}
$ rustc show-typedef.rs
show-typedef.rs:4:17: 4:19 error: mismatched types: expected `i64`, found `()` (expected i64, found ())
show-typedef.rs:4             let () = a;
                                  ^~
error: aborting due to previous error

It would be great if rustc could show libc::ssize_t as well as i64 in the error message. Compare it with GCC 4.9

$ g++49 show-typedef.cpp
show-typedef.cpp: In function 'int main()':
show-typedef.cpp:3:28: error: invalid operands of types 'void' and 'const size_type {aka const long unsigned int}' to binary 'operator+'
     (void)0 + std::string::npos;
                            ^
#include <string>
int main() {
    (void)0 + std::string::npos;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions