diff options
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/attr.rs | 2 | ||||
-rw-r--r-- | crates/hir_def/src/import_map.rs | 18 | ||||
-rw-r--r-- | crates/hir_def/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 5 |
4 files changed, 12 insertions, 15 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index e4c84afbf..8d925c0c1 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -209,7 +209,7 @@ impl Attrs { | |||
209 | }, | 209 | }, |
210 | AttrDefId::TraitId(it) => attrs_from_item_tree(it.lookup(db).id, db), | 210 | AttrDefId::TraitId(it) => attrs_from_item_tree(it.lookup(db).id, db), |
211 | AttrDefId::MacroDefId(it) => { | 211 | AttrDefId::MacroDefId(it) => { |
212 | it.ast_id.map_or_else(Default::default, |ast_id| attrs_from_ast(ast_id, db)) | 212 | it.ast_id().map_or_else(Default::default, |ast_id| attrs_from_ast(ast_id, db)) |
213 | } | 213 | } |
214 | AttrDefId::ImplId(it) => attrs_from_item_tree(it.lookup(db).id, db), | 214 | AttrDefId::ImplId(it) => attrs_from_item_tree(it.lookup(db).id, db), |
215 | AttrDefId::ConstId(it) => attrs_from_item_tree(it.lookup(db).id, db), | 215 | AttrDefId::ConstId(it) => attrs_from_item_tree(it.lookup(db).id, db), |
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs index 369bc3350..960cabb5f 100644 --- a/crates/hir_def/src/import_map.rs +++ b/crates/hir_def/src/import_map.rs | |||
@@ -912,10 +912,10 @@ mod tests { | |||
912 | dep::fmt (t) | 912 | dep::fmt (t) |
913 | dep::format (f) | 913 | dep::format (f) |
914 | dep::Fmt (v) | 914 | dep::Fmt (v) |
915 | dep::fmt::Display (t) | 915 | dep::Fmt (m) |
916 | dep::Fmt (t) | 916 | dep::Fmt (t) |
917 | dep::fmt::Display::fmt (a) | 917 | dep::fmt::Display::fmt (a) |
918 | dep::Fmt (m) | 918 | dep::fmt::Display (t) |
919 | "#]], | 919 | "#]], |
920 | ); | 920 | ); |
921 | 921 | ||
@@ -926,9 +926,9 @@ mod tests { | |||
926 | expect![[r#" | 926 | expect![[r#" |
927 | dep::fmt (t) | 927 | dep::fmt (t) |
928 | dep::Fmt (v) | 928 | dep::Fmt (v) |
929 | dep::Fmt (m) | ||
929 | dep::Fmt (t) | 930 | dep::Fmt (t) |
930 | dep::fmt::Display::fmt (a) | 931 | dep::fmt::Display::fmt (a) |
931 | dep::Fmt (m) | ||
932 | "#]], | 932 | "#]], |
933 | ); | 933 | ); |
934 | 934 | ||
@@ -939,10 +939,10 @@ mod tests { | |||
939 | expect![[r#" | 939 | expect![[r#" |
940 | dep::fmt (t) | 940 | dep::fmt (t) |
941 | dep::Fmt (v) | 941 | dep::Fmt (v) |
942 | dep::fmt::Display (t) | 942 | dep::Fmt (m) |
943 | dep::Fmt (t) | 943 | dep::Fmt (t) |
944 | dep::fmt::Display::fmt (a) | 944 | dep::fmt::Display::fmt (a) |
945 | dep::Fmt (m) | 945 | dep::fmt::Display (t) |
946 | "#]], | 946 | "#]], |
947 | ); | 947 | ); |
948 | } | 948 | } |
@@ -980,10 +980,10 @@ mod tests { | |||
980 | expect![[r#" | 980 | expect![[r#" |
981 | dep::fmt (t) | 981 | dep::fmt (t) |
982 | dep::Fmt (v) | 982 | dep::Fmt (v) |
983 | dep::fmt::Display (t) | 983 | dep::Fmt (m) |
984 | dep::Fmt (t) | 984 | dep::Fmt (t) |
985 | dep::fmt::Display::fmt (a) | 985 | dep::fmt::Display::fmt (a) |
986 | dep::Fmt (m) | 986 | dep::fmt::Display (t) |
987 | "#]], | 987 | "#]], |
988 | ); | 988 | ); |
989 | 989 | ||
@@ -994,9 +994,9 @@ mod tests { | |||
994 | expect![[r#" | 994 | expect![[r#" |
995 | dep::fmt (t) | 995 | dep::fmt (t) |
996 | dep::Fmt (v) | 996 | dep::Fmt (v) |
997 | dep::Fmt (m) | ||
997 | dep::Fmt (t) | 998 | dep::Fmt (t) |
998 | dep::fmt::Display::fmt (a) | 999 | dep::fmt::Display::fmt (a) |
999 | dep::Fmt (m) | ||
1000 | "#]], | 1000 | "#]], |
1001 | ); | 1001 | ); |
1002 | } | 1002 | } |
@@ -1058,8 +1058,8 @@ mod tests { | |||
1058 | Query::new("".to_string()).limit(2), | 1058 | Query::new("".to_string()).limit(2), |
1059 | expect![[r#" | 1059 | expect![[r#" |
1060 | dep::fmt (t) | 1060 | dep::fmt (t) |
1061 | dep::Fmt (t) | ||
1062 | dep::Fmt (m) | 1061 | dep::Fmt (m) |
1062 | dep::Fmt (t) | ||
1063 | dep::Fmt (v) | 1063 | dep::Fmt (v) |
1064 | "#]], | 1064 | "#]], |
1065 | ); | 1065 | ); |
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 6758411a0..21add086d 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs | |||
@@ -650,7 +650,7 @@ fn macro_call_as_call_id( | |||
650 | ) -> Result<Result<MacroCallId, ErrorEmitted>, UnresolvedMacro> { | 650 | ) -> Result<Result<MacroCallId, ErrorEmitted>, UnresolvedMacro> { |
651 | let def: MacroDefId = resolver(call.path.clone()).ok_or(UnresolvedMacro)?; | 651 | let def: MacroDefId = resolver(call.path.clone()).ok_or(UnresolvedMacro)?; |
652 | 652 | ||
653 | let res = if let MacroDefKind::BuiltInEager(_) = def.kind { | 653 | let res = if let MacroDefKind::BuiltInEager(..) = def.kind { |
654 | let macro_call = InFile::new(call.ast_id.file_id, call.ast_id.to_node(db.upcast())); | 654 | let macro_call = InFile::new(call.ast_id.file_id, call.ast_id.to_node(db.upcast())); |
655 | let hygiene = Hygiene::new(db.upcast(), call.ast_id.file_id); | 655 | let hygiene = Hygiene::new(db.upcast(), call.ast_id.file_id); |
656 | 656 | ||
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index d0fefb5af..45a79e896 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -357,13 +357,11 @@ impl DefCollector<'_> { | |||
357 | self.exports_proc_macros = true; | 357 | self.exports_proc_macros = true; |
358 | let macro_def = match self.proc_macros.iter().find(|(n, _)| n == name) { | 358 | let macro_def = match self.proc_macros.iter().find(|(n, _)| n == name) { |
359 | Some((_, expander)) => MacroDefId { | 359 | Some((_, expander)) => MacroDefId { |
360 | ast_id: None, | ||
361 | krate: self.def_map.krate, | 360 | krate: self.def_map.krate, |
362 | kind: MacroDefKind::ProcMacro(*expander), | 361 | kind: MacroDefKind::ProcMacro(*expander), |
363 | local_inner: false, | 362 | local_inner: false, |
364 | }, | 363 | }, |
365 | None => MacroDefId { | 364 | None => MacroDefId { |
366 | ast_id: None, | ||
367 | krate: self.def_map.krate, | 365 | krate: self.def_map.krate, |
368 | kind: MacroDefKind::ProcMacro(ProcMacroExpander::dummy(self.def_map.krate)), | 366 | kind: MacroDefKind::ProcMacro(ProcMacroExpander::dummy(self.def_map.krate)), |
369 | local_inner: false, | 367 | local_inner: false, |
@@ -1445,9 +1443,8 @@ impl ModCollector<'_, '_> { | |||
1445 | 1443 | ||
1446 | // Case 2: normal `macro_rules!` macro | 1444 | // Case 2: normal `macro_rules!` macro |
1447 | let macro_id = MacroDefId { | 1445 | let macro_id = MacroDefId { |
1448 | ast_id: Some(ast_id), | ||
1449 | krate: self.def_collector.def_map.krate, | 1446 | krate: self.def_collector.def_map.krate, |
1450 | kind: MacroDefKind::Declarative, | 1447 | kind: MacroDefKind::Declarative(ast_id), |
1451 | local_inner: is_local_inner, | 1448 | local_inner: is_local_inner, |
1452 | }; | 1449 | }; |
1453 | self.def_collector.define_macro(self.module_id, mac.name.clone(), macro_id, is_export); | 1450 | self.def_collector.define_macro(self.module_id, mac.name.clone(), macro_id, is_export); |