Skip to content

failure to resolve import #12545

Closed
Closed
@alsam

Description

@alsam

cat main.rs

//extern crate collections;

pub mod sub;

fn main() {
}

cat sub.rs

cat sub.rs

extern crate collections;

use collections::TreeMap;
rustc main.rs 
sub.rs:4:5: 4:16 error: unresolved import. maybe a missing `extern crate collections`?
sub.rs:4 use collections::TreeMap;
             ^~~~~~~~~~~
sub.rs:4:5: 4:25 error: failed to resolve import `collections::TreeMap`
sub.rs:4 use collections::TreeMap;
             ^~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

Looks like a bug for me because there is explicit extern crate collections; in sub.rs
If uncomment //extern crate collections; in main.rs that is at top level the code will compile ok:

rustc main.rs 
sub.rs:4:5: 4:25 warning: unused import, #[warn(unused_imports)] on by default
sub.rs:4 use collections::TreeMap;
             ^~~~~~~~~~~~~~~~~~~~

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