aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/nameres.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 7ec6512b6..04cc693b3 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -251,10 +251,14 @@ where
251 }; 251 };
252 } 252 }
253 for (import_id, import_data) in input.imports.iter() { 253 for (import_id, import_data) in input.imports.iter() {
254 if let Some(segment) = import_data.path.segments.iter().last() { 254 if let Some(last_segment) = import_data.path.segments.iter().last() {
255 if !import_data.is_glob { 255 if !import_data.is_glob {
256 let name = import_data
257 .alias
258 .clone()
259 .unwrap_or_else(|| last_segment.name.clone());
256 module_items.items.insert( 260 module_items.items.insert(
257 segment.name.clone(), 261 name,
258 Resolution { 262 Resolution {
259 def: PerNs::none(), 263 def: PerNs::none(),
260 import: Some(import_id), 264 import: Some(import_id),
@@ -319,19 +323,18 @@ where
319 323
320 if reached_fixedpoint == ReachedFixedPoint::Yes { 324 if reached_fixedpoint == ReachedFixedPoint::Yes {
321 let last_segment = import.path.segments.last().unwrap(); 325 let last_segment = import.path.segments.last().unwrap();
326 let name = import
327 .alias
328 .clone()
329 .unwrap_or_else(|| last_segment.name.clone());
330 log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def,);
322 self.update(module_id, |items| { 331 self.update(module_id, |items| {
323 let res = Resolution { 332 let res = Resolution {
324 def, 333 def,
325 import: Some(import_id), 334 import: Some(import_id),
326 }; 335 };
327 items.items.insert(last_segment.name.clone(), res); 336 items.items.insert(name, res);
328 }); 337 });
329 log::debug!(
330 "resolved import {:?} ({:?}) cross-source root to {:?}",
331 last_segment.name,
332 import,
333 def,
334 );
335 } 338 }
336 reached_fixedpoint 339 reached_fixedpoint
337 } 340 }