diff options
Diffstat (limited to 'crates/hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index d9d6c91a8..7f9fdb379 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -351,7 +351,7 @@ impl DefCollector<'_> { | |||
351 | let mut i = 0; | 351 | let mut i = 0; |
352 | 'outer: loop { | 352 | 'outer: loop { |
353 | loop { | 353 | loop { |
354 | self.db.check_canceled(); | 354 | self.db.unwind_if_cancelled(); |
355 | loop { | 355 | loop { |
356 | if self.resolve_imports() == ReachedFixedPoint::Yes { | 356 | if self.resolve_imports() == ReachedFixedPoint::Yes { |
357 | break; | 357 | break; |
@@ -836,7 +836,7 @@ impl DefCollector<'_> { | |||
836 | vis: Visibility, | 836 | vis: Visibility, |
837 | import_type: ImportType, | 837 | import_type: ImportType, |
838 | ) { | 838 | ) { |
839 | self.db.check_canceled(); | 839 | self.db.unwind_if_cancelled(); |
840 | self.update_recursive(module_id, resolutions, vis, import_type, 0) | 840 | self.update_recursive(module_id, resolutions, vis, import_type, 0) |
841 | } | 841 | } |
842 | 842 | ||
@@ -1679,14 +1679,22 @@ impl ModCollector<'_, '_> { | |||
1679 | None => &mac.name, | 1679 | None => &mac.name, |
1680 | }; | 1680 | }; |
1681 | let krate = self.def_collector.def_map.krate; | 1681 | let krate = self.def_collector.def_map.krate; |
1682 | if let Some(macro_id) = find_builtin_macro(name, krate, ast_id) { | 1682 | match find_builtin_macro(name, krate, ast_id) { |
1683 | self.def_collector.define_macro_rules( | 1683 | Some(macro_id) => { |
1684 | self.module_id, | 1684 | self.def_collector.define_macro_rules( |
1685 | mac.name.clone(), | 1685 | self.module_id, |
1686 | macro_id, | 1686 | mac.name.clone(), |
1687 | is_export, | 1687 | macro_id, |
1688 | ); | 1688 | is_export, |
1689 | return; | 1689 | ); |
1690 | return; | ||
1691 | } | ||
1692 | None => { | ||
1693 | self.def_collector | ||
1694 | .def_map | ||
1695 | .diagnostics | ||
1696 | .push(DefDiagnostic::unimplemented_builtin_macro(self.module_id, ast_id)); | ||
1697 | } | ||
1690 | } | 1698 | } |
1691 | } | 1699 | } |
1692 | 1700 | ||
@@ -1715,15 +1723,23 @@ impl ModCollector<'_, '_> { | |||
1715 | let macro_id = find_builtin_macro(&mac.name, krate, ast_id) | 1723 | let macro_id = find_builtin_macro(&mac.name, krate, ast_id) |
1716 | .or_else(|| find_builtin_derive(&mac.name, krate, ast_id)); | 1724 | .or_else(|| find_builtin_derive(&mac.name, krate, ast_id)); |
1717 | 1725 | ||
1718 | if let Some(macro_id) = macro_id { | 1726 | match macro_id { |
1719 | self.def_collector.define_macro_def( | 1727 | Some(macro_id) => { |
1720 | self.module_id, | 1728 | self.def_collector.define_macro_def( |
1721 | mac.name.clone(), | 1729 | self.module_id, |
1722 | macro_id, | 1730 | mac.name.clone(), |
1723 | &self.item_tree[mac.visibility], | 1731 | macro_id, |
1724 | ); | 1732 | &self.item_tree[mac.visibility], |
1733 | ); | ||
1734 | return; | ||
1735 | } | ||
1736 | None => { | ||
1737 | self.def_collector | ||
1738 | .def_map | ||
1739 | .diagnostics | ||
1740 | .push(DefDiagnostic::unimplemented_builtin_macro(self.module_id, ast_id)); | ||
1741 | } | ||
1725 | } | 1742 | } |
1726 | return; | ||
1727 | } | 1743 | } |
1728 | 1744 | ||
1729 | // Case 2: normal `macro` | 1745 | // Case 2: normal `macro` |