diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-04 09:44:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-04 09:44:31 +0000 |
commit | 73c36fdbd2060bd455ffeef33dca1ecc2ae07ebb (patch) | |
tree | 59440abef01f92ac250e45cac4923dd6de712180 /crates/ra_hir_def/src/nameres/raw.rs | |
parent | 918547dbe9a2907401102eba491ac25cebe1404d (diff) | |
parent | f4f71e361ee632a7a09b633934a9c0a11f4a9be7 (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/raw.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index fac1169ef..650cf1f98 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -22,8 +22,11 @@ use ra_syntax::{ | |||
22 | use test_utils::tested_by; | 22 | use test_utils::tested_by; |
23 | 23 | ||
24 | use crate::{ | 24 | use crate::{ |
25 | attr::Attrs, db::DefDatabase, path::ModPath, visibility::RawVisibility, FileAstId, HirFileId, | 25 | attr::Attrs, |
26 | InFile, | 26 | db::DefDatabase, |
27 | path::{ImportAlias, ModPath}, | ||
28 | visibility::RawVisibility, | ||
29 | FileAstId, HirFileId, InFile, | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | /// `RawItems` is a set of top-level items in a file (except for impls). | 32 | /// `RawItems` is a set of top-level items in a file (except for impls). |
@@ -145,7 +148,7 @@ impl_arena_id!(Import); | |||
145 | #[derive(Debug, Clone, PartialEq, Eq)] | 148 | #[derive(Debug, Clone, PartialEq, Eq)] |
146 | pub struct ImportData { | 149 | pub struct ImportData { |
147 | pub(super) path: ModPath, | 150 | pub(super) path: ModPath, |
148 | pub(super) alias: Option<Name>, | 151 | pub(super) alias: Option<ImportAlias>, |
149 | pub(super) is_glob: bool, | 152 | pub(super) is_glob: bool, |
150 | pub(super) is_prelude: bool, | 153 | pub(super) is_prelude: bool, |
151 | pub(super) is_extern_crate: bool, | 154 | pub(super) is_extern_crate: bool, |
@@ -353,7 +356,11 @@ impl RawItemsCollector { | |||
353 | let path = ModPath::from_name_ref(&name_ref); | 356 | let path = ModPath::from_name_ref(&name_ref); |
354 | let visibility = | 357 | let visibility = |
355 | RawVisibility::from_ast_with_hygiene(extern_crate.visibility(), &self.hygiene); | 358 | RawVisibility::from_ast_with_hygiene(extern_crate.visibility(), &self.hygiene); |
356 | let alias = extern_crate.alias().and_then(|a| a.name()).map(|it| it.as_name()); | 359 | let alias = extern_crate.alias().map(|a| { |
360 | a.name() | ||
361 | .map(|it| it.as_name()) | ||
362 | .map_or(ImportAlias::Underscore, |a| ImportAlias::Alias(a)) | ||
363 | }); | ||
357 | let attrs = self.parse_attrs(&extern_crate); | 364 | let attrs = self.parse_attrs(&extern_crate); |
358 | // FIXME: cfg_attr | 365 | // FIXME: cfg_attr |
359 | let is_macro_use = extern_crate.has_atom_attr("macro_use"); | 366 | let is_macro_use = extern_crate.has_atom_attr("macro_use"); |