Unresolved import in Rust. Can't find crate

Viewed 779

I encountered this error when I try to use use crate::some_module but I can use use my_package::some_module. Anyone know why it works with the latter, but doesn't work with the first one?

Error:

error[E0432]: unresolved import `crate::some_module`

unresolved import
   help: a similar path exists: `my_package::some_module`

Cargo.toml

[package]
name = "my_package"
//Bunch of other lines and dependencies

lib.rs

pub mod some_module;
//Bunch of other modules

Project structure:

my_package
|_src
  |_main.rs
  |_lib.rs
  |_some_module.rs

|_Cargo.toml
0 Answers
Related