Skip to content

Compiler message need improve for OrdSliceExt::sort() #20162

Closed
@liigo

Description

@liigo

Code:

// #[deriving(Eq, Ord, PartialEq, PartialOrd)]
struct X { x: int }

pub fn main() {
    let mut b: Vec<X> = Vec::new();
    b.sort();
}

Error:

tmp.rs:6:7: 6:13 error: type `collections::vec::Vec<X>` does not implement any method in scope named `sort`
tmp.rs:6     b.sort();

The compiler should tell us, struct X doesn't implements Ord, at least.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions