diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-11 10:53:24 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-11 10:53:24 +0000 |
commit | ef2a9aedb6ac7f0b79e636cff7947935fecb909d (patch) | |
tree | a603361f9e6c02d90c0ae8cdfd0902370677f71d /crates/ra_hir_expand/src/hygiene.rs | |
parent | 5ac4ffbc121c8231fe3ea5c2bb918f7aae60f197 (diff) | |
parent | 4f7df2aac107c0de2cab851f2a4f1ab369511fc8 (diff) |
Merge #2205
2205: Implement bulitin line! macro r=matklad a=edwin0cheng
This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros:
1. Extend `MacroDefId` to support builtin macros
2. Add a `quote!` macro for simple quasi quoting.
Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_expand/src/hygiene.rs')
-rw-r--r-- | crates/ra_hir_expand/src/hygiene.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir_expand/src/hygiene.rs b/crates/ra_hir_expand/src/hygiene.rs index 77428ec99..379562a2c 100644 --- a/crates/ra_hir_expand/src/hygiene.rs +++ b/crates/ra_hir_expand/src/hygiene.rs | |||
@@ -9,7 +9,7 @@ use crate::{ | |||
9 | db::AstDatabase, | 9 | db::AstDatabase, |
10 | either::Either, | 10 | either::Either, |
11 | name::{AsName, Name}, | 11 | name::{AsName, Name}, |
12 | HirFileId, HirFileIdRepr, | 12 | HirFileId, HirFileIdRepr, MacroDefKind, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #[derive(Debug)] | 15 | #[derive(Debug)] |
@@ -24,7 +24,10 @@ impl Hygiene { | |||
24 | HirFileIdRepr::FileId(_) => None, | 24 | HirFileIdRepr::FileId(_) => None, |
25 | HirFileIdRepr::MacroFile(macro_file) => { | 25 | HirFileIdRepr::MacroFile(macro_file) => { |
26 | let loc = db.lookup_intern_macro(macro_file.macro_call_id); | 26 | let loc = db.lookup_intern_macro(macro_file.macro_call_id); |
27 | Some(loc.def.krate) | 27 | match loc.def.kind { |
28 | MacroDefKind::Declarative => Some(loc.def.krate), | ||
29 | MacroDefKind::BuiltIn(_) => None, | ||
30 | } | ||
28 | } | 31 | } |
29 | }; | 32 | }; |
30 | Hygiene { def_crate } | 33 | Hygiene { def_crate } |