diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-14 07:12:09 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-14 07:12:09 +0100 |
commit | c417c77b681f10cc7585507bd874e9fd2cea63b8 (patch) | |
tree | d05cf30716a7791cfc0d8fcfe522a7132b5fff06 /crates/ra_hir/src/lib.rs | |
parent | ee0ab7c00b4b8c5375c14b44e3d7288ebf0d732d (diff) | |
parent | caa8663c08e1724af2abcde11fa937937d76aa14 (diff) |
Merge #1267
1267: Macro expand to r=edwin0cheng a=matklad
closes #1264
The core problem this PR is trying to wrangle is that macros can expand to different stuffs, depending on context.
That is, `foo!()` on the top-level expands to a list of items, but the same `foo!()` in expression position expands to expression.
Our current `hir_parse(HirFileId) -> TreeArc<SourceFile>` does not really support this.
So, the plan is to change `hir_parse` to untyped inreface (`TreeArc<Syntaxnode>`), and add `expands_to` field to `MacroCallLoc`, such that the *target* of macro expansion is selected by the calling code and is part of macro id.
This unfortunately looses some type-safety :(
Moreover, this doesn't really fix #1264 by itself, because we die due to some other error inside macro expansion: expander fails to produce a tree with a single root, which trips assert inside rowan.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/lib.rs')
-rw-r--r-- | crates/ra_hir/src/lib.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 03b1063b6..0c6d7c2b7 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -53,6 +53,7 @@ use crate::{ | |||
53 | name::{AsName, KnownName}, | 53 | name::{AsName, KnownName}, |
54 | source_id::{FileAstId, AstId}, | 54 | source_id::{FileAstId, AstId}, |
55 | resolve::Resolver, | 55 | resolve::Resolver, |
56 | ids::MacroFileKind, | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | pub use self::{ | 59 | pub use self::{ |