aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres/collector.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-04 09:44:31 +0000
committerGitHub <[email protected]>2020-02-04 09:44:31 +0000
commit73c36fdbd2060bd455ffeef33dca1ecc2ae07ebb (patch)
tree59440abef01f92ac250e45cac4923dd6de712180 /crates/ra_hir_def/src/nameres/collector.rs
parent918547dbe9a2907401102eba491ac25cebe1404d (diff)
parentf4f71e361ee632a7a09b633934a9c0a11f4a9be7 (diff)
Merge #2962
2962: Differentiate underscore alias from named aliases r=matklad a=zombiefungus pre for Fixing Issue 2736 edited to avoid autoclosing the issue Co-authored-by: zombiefungus <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 7499dff31..6352c71ef 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -22,7 +22,7 @@ use crate::{
22 diagnostics::DefDiagnostic, mod_resolution::ModDir, path_resolution::ReachedFixedPoint, 22 diagnostics::DefDiagnostic, mod_resolution::ModDir, path_resolution::ReachedFixedPoint,
23 raw, BuiltinShadowMode, CrateDefMap, ModuleData, ModuleOrigin, ResolveMode, 23 raw, BuiltinShadowMode, CrateDefMap, ModuleData, ModuleOrigin, ResolveMode,
24 }, 24 },
25 path::{ModPath, PathKind}, 25 path::{ImportAlias, ModPath, PathKind},
26 per_ns::PerNs, 26 per_ns::PerNs,
27 visibility::Visibility, 27 visibility::Visibility,
28 AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, 28 AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern,
@@ -438,7 +438,11 @@ where
438 } else { 438 } else {
439 match import.path.segments.last() { 439 match import.path.segments.last() {
440 Some(last_segment) => { 440 Some(last_segment) => {
441 let name = import.alias.clone().unwrap_or_else(|| last_segment.clone()); 441 let name = match &import.alias {
442 Some(ImportAlias::Alias(name)) => name.clone(),
443 Some(ImportAlias::Underscore) => last_segment.clone(), // FIXME rust-analyzer#2736
444 None => last_segment.clone(),
445 };
442 log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def); 446 log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);
443 447
444 // extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658 448 // extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658