Skip to content

unresolved import: could not find hashmap in std. #15082

Closed
@adnelson

Description

@adnelson

I'm a Rust beginner trying to write some code which uses a HashMap.

As per this documentation, I have this line:

use std::hashmap::HashMap;

And I get this error message when trying to compile:

$ rustc -v
rustc 0.11.0-pre (0ee6a8e 2014-06-09 23:41:53 -0700)
host: x86_64-apple-darwin
$ rustc foo.rs
foo.rs:1:5: 1:26 error: unresolved import: could not find `hashmap` in `std`.
foo.rs:1 use std::hashmap::HashMap;
            ^~~~~~~~~~~~~~~~~~~~~
foo.rs:1:5: 1:26 error: failed to resolve import `std::hashmap::HashMap`
foo.rs:1 use std::hashmap::HashMap;
            ^~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

I'm really struggling to find how to solve this error; I don't really know about rust's package management system, I don't know how to browse what I have or to install something that I don't have, and reading guides is frustrating because they always seem to be out of date. Can anyone help me with this? How do I get a hash map in rust?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions