diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-16 16:52:46 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-16 16:52:46 +0000 |
commit | 63bbdb31e5148c804bbf940963c9c8f3481ad258 (patch) | |
tree | 2732cd2c3878257d9b55447830bc824447332c98 /crates/hir_def/src/body | |
parent | 423f3872246f1a67b49e248f3437cb46fdfc8138 (diff) | |
parent | d34611633b3b2404188b9e12b08c5def589808c2 (diff) |
Merge #6897
6897: Basic support for macros 2.0 r=jonas-schievink a=jonas-schievink
This adds support for (built-in-only) macros 2.0, and removes some hacks used for builtin derives, which are declared via macros 2.0 in libcore.
First steps for https://github.com/rust-analyzer/rust-analyzer/issues/2248.
Blocked on https://github.com/rust-analyzer/ungrammar/pull/16.
Co-authored-by: Jonas Schievink <[email protected]>
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index bdba4c33e..23e2fd764 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -772,7 +772,10 @@ impl ExprCollector<'_> { | |||
772 | | ast::Item::Module(_) | 772 | | ast::Item::Module(_) |
773 | | ast::Item::MacroCall(_) => return None, | 773 | | ast::Item::MacroCall(_) => return None, |
774 | ast::Item::MacroRules(def) => { | 774 | ast::Item::MacroRules(def) => { |
775 | return Some(Either::Right(def)); | 775 | return Some(Either::Right(ast::Macro::from(def))); |
776 | } | ||
777 | ast::Item::MacroDef(def) => { | ||
778 | return Some(Either::Right(ast::Macro::from(def))); | ||
776 | } | 779 | } |
777 | }; | 780 | }; |
778 | 781 | ||
@@ -800,7 +803,7 @@ impl ExprCollector<'_> { | |||
800 | } | 803 | } |
801 | Either::Right(e) => { | 804 | Either::Right(e) => { |
802 | let mac = MacroDefId { | 805 | let mac = MacroDefId { |
803 | krate: Some(self.expander.module.krate), | 806 | krate: self.expander.module.krate, |
804 | ast_id: Some(self.expander.ast_id(&e)), | 807 | ast_id: Some(self.expander.ast_id(&e)), |
805 | kind: MacroDefKind::Declarative, | 808 | kind: MacroDefKind::Declarative, |
806 | local_inner: false, | 809 | local_inner: false, |