0

I have a lib.rs file containing:

mod bindings {
    // ...
}

pub use bindings::*;

What I get from rustc is:

|  pub use bindings::*;
|          ^^^^^^^^ can't find crate

Why does Rust think bindings is a crate instead of module?

2

1 Answer 1

2

You seem to be using the 2018 edition of Rust. There have been a few changes to paths in use declarations since the 2015 edition (aka Rust 1.0). The path after a use declaration now always needs to start with a crate name, the crate keyword denoting the root of the crate, self denoting the current module or super denoting the parent module. So either of these two use declarations should work:

pub use self::bindings::*;

or

pub use crate::bindings::*;
1
  • Thanks. I left out unintentionally that I'm using 2018 edition.
    – phodina
    Commented Oct 21, 2018 at 19:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.