E0432
rust
module_error
ai_generated
true
错误[E0432]: 无法解析导入 `crate::module::Item` —— 在 `module` 中找不到 `Item`
error[E0432]: unresolved import `crate::module::Item` -- could not find `Item` in `module`
ID: rust/e0432-import-conflict
90%修复率
85%置信度
1证据数
2024-03-18首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.65.0 | active | — | — | — |
| 1.72.0 | active | — | — | — |
| 1.80.0 | active | — | — | — |
根因分析
尝试从模块中导入一个不存在的项(结构体、函数等),通常是由于拼写错误、缺少模块声明或路径不正确。
English
Trying to import an item (struct, function, etc.) from a module where it doesn't exist, often due to a typo, missing module declaration, or incorrect path.
官方文档
https://doc.rust-lang.org/stable/error_codes/E0432.html解决方案
-
Verify the item name and module path. Check if the module is declared in 'mod.rs' or 'lib.rs'. Example: if module is 'src/utils.rs', use 'use crate::utils::Item;'.
-
If the item is re-exported, ensure the re-export is public: 'pub use other_module::Item;' in the module file.
无效尝试
常见但无效的做法:
-
70% 失败
Adding a 'mod' declaration in the wrong file — this creates a new module instead of importing from an existing one.
-
60% 失败
Using 'use super::module::Item' when the module is in a sibling file — this may reference the wrong scope.