Skip to content

Error message suggests using core when it ought to suggest using std #23355

Closed
@bstrie

Description

@bstrie

Program:

fn main() {
    Vec::from_iter();
}

Output:

fri.rs:2:5: 2:19 error: type `collections::vec::Vec<_>` does not implement any method in scope named `from_iter`
fri.rs:2     Vec::from_iter();
             ^~~~~~~~~~~~~~
fri.rs:2:19: 2:19 help: methods from traits can only be called if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
fri.rs:2:19: 2:19 help: candidate #1: use `core::iter::FromIterator`
error: aborting due to previous error

Note that it suggests core::iter::FromIterator when it could be suggesting std::iter::FromIterator. Should a user follow this advice, they would need to also link libcore via extern crate core, which (IIRC) means that they will be opting out of 1.0-stable thanks to core's intentional lack of stability.

I don't know if it's worth nominating, but this is definitely a backcompat hazard for users.

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