about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/imports.rs
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2025-06-27 01:35:54 +0800
committerbohan <bohan-zhang@foxmail.com>2025-06-29 00:23:35 +0800
commitf99cdf8b1c733bd3e20f6273bc1cb8bb6005d6a8 (patch)
treee3e8b77df38b8fa93cbd87b6cd37278913468471 /compiler/rustc_resolve/src/imports.rs
parentb63223c152212832ce37a109e26cc5f84c577532 (diff)
downloadrust-f99cdf8b1c733bd3e20f6273bc1cb8bb6005d6a8.tar.gz
rust-f99cdf8b1c733bd3e20f6273bc1cb8bb6005d6a8.zip
explain `ImportData::imported_module`
Diffstat (limited to 'compiler/rustc_resolve/src/imports.rs')
-rw-r--r--compiler/rustc_resolve/src/imports.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs
index 1b7a2c3bda0..2e81b54b136 100644
--- a/compiler/rustc_resolve/src/imports.rs
+++ b/compiler/rustc_resolve/src/imports.rs
@@ -174,7 +174,14 @@ pub(crate) struct ImportData<'ra> {
 
     pub parent_scope: ParentScope<'ra>,
     pub module_path: Vec<Segment>,
-    /// The resolution of `module_path`.
+    /// The resolution of `module_path`:
+    ///
+    /// | `module_path` | `imported_module` | remark |
+    /// |-|-|-|
+    /// |`use prefix::foo`| `ModuleOrUniformRoot::Module(prefix)`               | - |
+    /// |`use ::foo`      | `ModuleOrUniformRoot::ExternPrelude`                | 2018+ editions |
+    /// |`use ::foo`      | `ModuleOrUniformRoot::CrateRootAndExternPrelude`    | a special case in 2015 edition |
+    /// |`use foo`        | `ModuleOrUniformRoot::CurrentScope`                 | - |
     pub imported_module: Cell<Option<ModuleOrUniformRoot<'ra>>>,
     pub vis: ty::Visibility,
 }