Skip to content

Inferred types cause awful error messages #5124

Closed
@jdm

Description

@jdm
trait T {
    fn foo();
}

fn bar<V: T>(v: @V) {
    v.foo();
}

fn main() {
    bar(5);
}
/tmp/typecheck.rs:10:8: 10:9 error: mismatched types: expected `@<V0>` but found `<VI0>` (expected @-ptr but found integral variable)
/tmp/typecheck.rs:10     bar(5);
                             ^
/tmp/typecheck.rs:10:4: 10:7 error: cannot determine a type for this bounded type parameter: unconstrained type
/tmp/typecheck.rs:10     bar(5);
                         ^~~

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