Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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