aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres/collector.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-13 11:12:36 +0000
committerAleksey Kladov <[email protected]>2019-12-14 18:15:40 +0000
commit2619950b3b405324ab1c1745876165c834b3b4b9 (patch)
tree1f32b3f34bbdad0d58b3cbddf250c350cd546de6 /crates/ra_hir_def/src/nameres/collector.rs
parentf720855e1e45985463e31e0a6a2a76bb6ffd1cfa (diff)
Use different types for path with and without generics
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 5d7469a6e..912a073ea 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, Resolution, ResolveMode, 23 raw, BuiltinShadowMode, CrateDefMap, ModuleData, ModuleOrigin, Resolution, ResolveMode,
24 }, 24 },
25 path::{Path, PathKind}, 25 path::{ModPath, PathKind},
26 per_ns::PerNs, 26 per_ns::PerNs,
27 AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, 27 AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern,
28 LocalImportId, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, 28 LocalImportId, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc,
@@ -101,7 +101,7 @@ struct ImportDirective {
101struct MacroDirective { 101struct MacroDirective {
102 module_id: LocalModuleId, 102 module_id: LocalModuleId,
103 ast_id: AstId<ast::MacroCall>, 103 ast_id: AstId<ast::MacroCall>,
104 path: Path, 104 path: ModPath,
105 legacy: Option<MacroCallId>, 105 legacy: Option<MacroCallId>,
106} 106}
107 107
@@ -113,7 +113,7 @@ struct DefCollector<'a, DB> {
113 unresolved_imports: Vec<ImportDirective>, 113 unresolved_imports: Vec<ImportDirective>,
114 resolved_imports: Vec<ImportDirective>, 114 resolved_imports: Vec<ImportDirective>,
115 unexpanded_macros: Vec<MacroDirective>, 115 unexpanded_macros: Vec<MacroDirective>,
116 unexpanded_attribute_macros: Vec<(LocalModuleId, AstId<ast::ModuleItem>, Path)>, 116 unexpanded_attribute_macros: Vec<(LocalModuleId, AstId<ast::ModuleItem>, ModPath)>,
117 mod_dirs: FxHashMap<LocalModuleId, ModDir>, 117 mod_dirs: FxHashMap<LocalModuleId, ModDir>,
118 cfg_options: &'a CfgOptions, 118 cfg_options: &'a CfgOptions,
119} 119}
@@ -428,7 +428,7 @@ where
428 } else { 428 } else {
429 match import.path.segments.last() { 429 match import.path.segments.last() {
430 Some(last_segment) => { 430 Some(last_segment) => {
431 let name = import.alias.clone().unwrap_or_else(|| last_segment.name.clone()); 431 let name = import.alias.clone().unwrap_or_else(|| last_segment.clone());
432 log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def); 432 log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);
433 433
434 // extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658 434 // extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658
@@ -565,7 +565,7 @@ where
565 res 565 res
566 } 566 }
567 567
568 fn resolve_attribute_macro(&self, path: &Path) -> Option<MacroDefId> { 568 fn resolve_attribute_macro(&self, path: &ModPath) -> Option<MacroDefId> {
569 // FIXME this is currently super hacky, just enough to support the 569 // FIXME this is currently super hacky, just enough to support the
570 // built-in derives 570 // built-in derives
571 if let Some(name) = path.as_ident() { 571 if let Some(name) = path.as_ident() {
@@ -829,7 +829,7 @@ where
829 tt::TokenTree::Leaf(tt::Leaf::Punct(_)) => continue, // , is ok 829 tt::TokenTree::Leaf(tt::Leaf::Punct(_)) => continue, // , is ok
830 _ => continue, // anything else would be an error (which we currently ignore) 830 _ => continue, // anything else would be an error (which we currently ignore)
831 }; 831 };
832 let path = Path::from_tt_ident(ident); 832 let path = ModPath::from_tt_ident(ident);
833 833
834 let ast_id = AstId::new(self.file_id, def.kind.ast_id()); 834 let ast_id = AstId::new(self.file_id, def.kind.ast_id());
835 self.def_collector.unexpanded_attribute_macros.push((self.module_id, ast_id, path)); 835 self.def_collector.unexpanded_attribute_macros.push((self.module_id, ast_id, path));
@@ -917,7 +917,7 @@ where
917 } 917 }
918} 918}
919 919
920fn is_macro_rules(path: &Path) -> bool { 920fn is_macro_rules(path: &ModPath) -> bool {
921 path.as_ident() == Some(&name![macro_rules]) 921 path.as_ident() == Some(&name![macro_rules])
922} 922}
923 923