Skip to content

Better error messages for type-errors due to #[deriving]. #7621

Closed
@huonw

Description

@huonw

#[deriving(Trait)] normally relies on the constituent types of the struct or enum also implement Trait, and currently, if they don't, the error messages are unclear. e.g. in the following code, the problem is [f64, .. 3] doesn't implement Clone.

#[deriving(Clone)]
struct V {
    v : [f64, ..3]
}

fn main() {}
tmp.rs:1:11: 1:16 error: mismatched types: expected `[f64, .. 3]` but found `&[f64, .. 3]` (expected vector but found &-ptr)
tmp.rs:1 #[deriving(Clone)]

(This particular error message is because there is a Clone impl for &T, and that one is used if there is no Clone impl for T.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions