From d8a5d39c2d05fb59b6c243935111714e18334599 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 11 Jun 2020 11:30:06 +0200 Subject: Make relevant_crates return a Set --- crates/ra_hir_expand/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_hir_expand/src/lib.rs') diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index f440c073b..dc4d7f000 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -424,3 +424,8 @@ impl InFile { self.with_value(self.value.syntax()) } } + +// FIXME: this is obviously wrong, there shouldn't be any guesing here +fn guess_crate(db: &dyn db::AstDatabase, file_id: FileId) -> Option { + db.relevant_crates(file_id).iter().next().copied() +} -- cgit v1.2.3 From fac7b0e252ab305f5c8d69b04c46c587ee021aa9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 11 Jun 2020 12:08:24 +0200 Subject: Don't guess macro expansion crate --- crates/ra_hir_expand/src/lib.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_expand/src/lib.rs') diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index dc4d7f000..5eac2605b 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -209,8 +209,13 @@ pub struct MacroDefId { } impl MacroDefId { - pub fn as_lazy_macro(self, db: &dyn db::AstDatabase, kind: MacroCallKind) -> LazyMacroId { - db.intern_macro(MacroCallLoc { def: self, kind }) + pub fn as_lazy_macro( + self, + db: &dyn db::AstDatabase, + krate: CrateId, + kind: MacroCallKind, + ) -> LazyMacroId { + db.intern_macro(MacroCallLoc { def: self, krate, kind }) } } @@ -227,6 +232,7 @@ pub enum MacroDefKind { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroCallLoc { pub(crate) def: MacroDefId, + pub(crate) krate: CrateId, pub(crate) kind: MacroCallKind, } @@ -274,6 +280,7 @@ pub struct EagerCallLoc { pub(crate) def: MacroDefId, pub(crate) fragment: FragmentKind, pub(crate) subtree: Arc, + pub(crate) krate: CrateId, pub(crate) file_id: HirFileId, } @@ -424,8 +431,3 @@ impl InFile { self.with_value(self.value.syntax()) } } - -// FIXME: this is obviously wrong, there shouldn't be any guesing here -fn guess_crate(db: &dyn db::AstDatabase, file_id: FileId) -> Option { - db.relevant_crates(file_id).iter().next().copied() -} -- cgit v1.2.3