E5xxx: Module and import errors
This page is generated by scripts/docs/gen-error-code-docs.py from the define_codes! registry in src/util/diagnostic/codes/ and locales/en.json. Do not edit it by hand. Change the wording in locales/*.json, change the code table in define_codes!, then rerun python scripts/docs/gen-error-code-docs.py.
Errors related to the module system and import resolution.
This family holds 8 codes, all registered in the define_codes! registry, with the category Module. See the error code index for the complete inventory.
Code Overview
| Code | Name | Category | span exempt | Template | Emission sites |
|---|---|---|---|---|---|
E5001 | Module not found | Module | No | Module '{module}' not found | ✅ 1 site |
E5002 | Import error | Module | No | Failed to import module '{module}': {reason} | ✅ 1 site |
E5003 | Export not found | Module | No | export '{export}' not found in module '{module}' | ✅ 1 site |
E5004 | Circular dependency | Module | No | circular dependency detected: {path} | ⚠ Not yet emitted |
E5005 | Invalid module path | Module | No | Invalid module path: '{path}' | ⚠ Not yet emitted |
E5006 | Duplicate import | Module | No | Duplicate import: '{name}' has already been imported | ✅ 1 site |
E5007 | Module exports | Module | No | Exports of module '{module}': {available} | ⚠ Not yet emitted |
E5008 | Import name conflict | Module | No | Import name '{name}' conflicts with an existing binding (imported from '{module}') | ✅ 1 site |
Code Details
E5001: Module not found
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::module_not_found(module) - Template:
Module '{module}' not found - Message: The referenced module does not exist
- Help: Check the module path and ensure it exists
- Emission sites:
src/frontend/core/sema/inference/statements/imports.rs:282 - Source comment name:
模块未找到
E5002: Import error
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::import_error(module, reason) - Template:
Failed to import module '{module}': {reason} - Message: Failed to import module
- Help: Check the import path and module resolution
- Emission sites:
src/frontend/core/sema/checker/use_import.rs:265 - Source comment name:
导入错误
E5003: Export not found
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::export_not_found(export, module) - Template:
export '{export}' not found in module '{module}' - Message: export does not exist in module
- Help: Check the module's exports
- Emission sites:
src/frontend/core/sema/inference/statements/imports.rs:371 - Source comment name:
导出未找到
E5004: Circular dependency
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::circular_dependency(path) - Template:
circular dependency detected: {path} - Message: module has a circular dependency
- Help: refactor to remove the circular dependency
- Emission site: ⚠ Not yet emitted (the registry retains the code, but non-test code never calls it, so users cannot trigger it)
- Source comment name:
循环依赖
E5005: Invalid module path
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::invalid_module_path(path) - Template:
Invalid module path: '{path}' - Help: Check the module path format
- Emission site: ⚠ Not yet emitted (the registry retains the code, but non-test code never calls it, so users cannot trigger it)
- Source comment name:
无效的模块路径
E5006: Duplicate import
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::duplicate_import(name) - Template:
Duplicate import: '{name}' has already been imported - Help: Please remove the duplicate import, or use a different name/module alias
- Emission sites:
src/frontend/core/sema/inference/statements/imports.rs:69 - Source comment name:
重复导入
E5007: Module exports
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::module_exports_hint(module, available) - Template:
Exports of module '{module}': {available} - Help: Available exports are listed in the error message
- Emission site: ⚠ Not yet emitted (the registry retains the code, but non-test code never calls it, so users cannot trigger it)
- Source comment name:
模块导出提示(用于辅助错误消息)
E5008: Import name conflict
- Category:
Module - span exempt: No
- Constructor:
ErrorCodeDefinition::import_name_conflict(name, module) - Template:
Import name '{name}' conflicts with an existing binding (imported from '{module}') - Help: Please use a different name or module alias
- Emission sites:
src/frontend/core/sema/inference/statements/imports.rs:78 - Source comment name:
导入名与现有绑定冲突(#414,RFC-029 §导入冲突)
