aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres/raw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres/raw.rs')
-rw-r--r--crates/ra_hir_def/src/nameres/raw.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index fac1169ef..f068b4d4e 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -145,7 +145,7 @@ impl_arena_id!(Import);
145#[derive(Debug, Clone, PartialEq, Eq)] 145#[derive(Debug, Clone, PartialEq, Eq)]
146pub struct ImportData { 146pub struct ImportData {
147 pub(super) path: ModPath, 147 pub(super) path: ModPath,
148 pub(super) alias: Option<Name>, 148 pub(super) alias: ImportAlias,
149 pub(super) is_glob: bool, 149 pub(super) is_glob: bool,
150 pub(super) is_prelude: bool, 150 pub(super) is_prelude: bool,
151 pub(super) is_extern_crate: bool, 151 pub(super) is_extern_crate: bool,
@@ -153,6 +153,13 @@ pub struct ImportData {
153 pub(super) visibility: RawVisibility, 153 pub(super) visibility: RawVisibility,
154} 154}
155 155
156#[derive(Debug, Clone, PartialEq, Eq)]
157pub enum ImportAlias {
158 NoAlias,
159 Unnamed, // use Foo as _;
160 Alias(Name),
161}
162
156#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 163#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
157pub(super) struct Def(RawId); 164pub(super) struct Def(RawId);
158impl_arena_id!(Def); 165impl_arena_id!(Def);
@@ -353,7 +360,11 @@ impl RawItemsCollector {
353 let path = ModPath::from_name_ref(&name_ref); 360 let path = ModPath::from_name_ref(&name_ref);
354 let visibility = 361 let visibility =
355 RawVisibility::from_ast_with_hygiene(extern_crate.visibility(), &self.hygiene); 362 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()); 363 let alias = extern_crate.alias().map_or(ImportAlias::NoAlias, |a| {
364 a.name()
365 .map(|it| it.as_name())
366 .map_or(ImportAlias::Unnamed, |a| ImportAlias::Alias(a))
367 });
357 let attrs = self.parse_attrs(&extern_crate); 368 let attrs = self.parse_attrs(&extern_crate);
358 // FIXME: cfg_attr 369 // FIXME: cfg_attr
359 let is_macro_use = extern_crate.has_atom_attr("macro_use"); 370 let is_macro_use = extern_crate.has_atom_attr("macro_use");