E0433
Rust Programming Language
Severity: MinorWhat Does This Error Mean?
Rust error E0433 means a module path in your use statement or code could not be resolved. For example, writing use std::collections::HashMapp (note the typo) would cause this error. The path leads to a module or item that does not exist or has not been declared. Fix it by checking the path spelling, making sure the module is declared, and confirming any external crates are in Cargo.toml.
Affected Models
- Rust 1.0 and later
- All Rust editions (2015, 2018, 2021)
- cargo build and rustc
Common Causes
- Typo in a module name or crate name in a use statement
- Referencing a module that has not been declared with mod in the parent file
- Using a crate name in code without adding it to Cargo.toml
- Incorrect path separator — using :: incorrectly or missing a segment
- A private module being accessed from outside its parent — the module is not public
How to Fix It
-
Read the error and identify the full module path that failed. Compare it letter-by-letter to the actual path.
Module names in Rust use snake_case. Check for capitalization mistakes as well as typos.
-
If you are using a module from your own code, make sure it is declared in your main.rs or lib.rs with: mod my_module;
Just creating a file called my_module.rs is not enough. You must also write 'mod my_module;' in the parent file.
-
If you are using an external crate, check that it is listed in Cargo.toml under [dependencies] with the correct name and version.
Some crates have different package names and module names. Check the crate's page on crates.io for the correct use path.
-
Check that the module or item you are referencing is marked as public with the pub keyword.
In Rust, items are private by default. Use 'pub mod', 'pub fn', or 'pub struct' to make them accessible from outside.
-
Look at the official Rust documentation or the crate's docs.rs page to confirm the exact path to the item you want.
Paths change between crate versions. Make sure your Cargo.toml version matches the documentation you are reading.
When to Call a Professional
E0433 is a compile-time error that is almost always caused by a typo or a missing declaration. The compiler error message shows the full path that failed to resolve. Compare the path carefully against the actual file structure and crate documentation.
Frequently Asked Questions
What does 'use of undeclared crate or module' mean?
It means Rust found a name at the start of a path that it does not recognize as a crate or module. This is often caused by a missing entry in Cargo.toml, or forgetting to write 'mod my_module;' in lib.rs or main.rs. Add the missing declaration and the error will go away.
My module file exists — why does Rust still say it cannot find it?
Creating the file is not enough. Rust requires an explicit module declaration. In main.rs or lib.rs, you must write 'mod my_module;' to tell the compiler the module exists. For nested modules, you need a mod.rs file or an explicit declaration in each parent module file.
How do I find the correct use path for a standard library type?
Search for the type on doc.rust-lang.org. The page shows the exact path at the top. For example, the HashMap page shows 'std::collections::HashMap', so the use statement is: use std::collections::HashMap; For third-party crates, search on docs.rs for the crate name.