aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src/builtin_derive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_expand/src/builtin_derive.rs')
-rw-r--r--crates/hir_expand/src/builtin_derive.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs
index b6a6d602f..fe9497b50 100644
--- a/crates/hir_expand/src/builtin_derive.rs
+++ b/crates/hir_expand/src/builtin_derive.rs
@@ -8,7 +8,7 @@ use syntax::{
8 match_ast, 8 match_ast,
9}; 9};
10 10
11use crate::{db::AstDatabase, name, quote, AstId, CrateId, LazyMacroId, MacroDefId, MacroDefKind}; 11use crate::{db::AstDatabase, name, quote, AstId, CrateId, MacroCallId, MacroDefId, MacroDefKind};
12 12
13macro_rules! register_builtin { 13macro_rules! register_builtin {
14 ( $($trait:ident => $expand:ident),* ) => { 14 ( $($trait:ident => $expand:ident),* ) => {
@@ -21,7 +21,7 @@ macro_rules! register_builtin {
21 pub fn expand( 21 pub fn expand(
22 &self, 22 &self,
23 db: &dyn AstDatabase, 23 db: &dyn AstDatabase,
24 id: LazyMacroId, 24 id: MacroCallId,
25 tt: &tt::Subtree, 25 tt: &tt::Subtree,
26 ) -> Result<tt::Subtree, mbe::ExpandError> { 26 ) -> Result<tt::Subtree, mbe::ExpandError> {
27 let expander = match *self { 27 let expander = match *self {
@@ -164,7 +164,7 @@ fn expand_simple_derive(
164 Ok(expanded) 164 Ok(expanded)
165} 165}
166 166
167fn find_builtin_crate(db: &dyn AstDatabase, id: LazyMacroId) -> tt::TokenTree { 167fn find_builtin_crate(db: &dyn AstDatabase, id: MacroCallId) -> tt::TokenTree {
168 // FIXME: make hygiene works for builtin derive macro 168 // FIXME: make hygiene works for builtin derive macro
169 // such that $crate can be used here. 169 // such that $crate can be used here.
170 let cg = db.crate_graph(); 170 let cg = db.crate_graph();
@@ -184,7 +184,7 @@ fn find_builtin_crate(db: &dyn AstDatabase, id: LazyMacroId) -> tt::TokenTree {
184 184
185fn copy_expand( 185fn copy_expand(
186 db: &dyn AstDatabase, 186 db: &dyn AstDatabase,
187 id: LazyMacroId, 187 id: MacroCallId,
188 tt: &tt::Subtree, 188 tt: &tt::Subtree,
189) -> Result<tt::Subtree, mbe::ExpandError> { 189) -> Result<tt::Subtree, mbe::ExpandError> {
190 let krate = find_builtin_crate(db, id); 190 let krate = find_builtin_crate(db, id);
@@ -193,7 +193,7 @@ fn copy_expand(
193 193
194fn clone_expand( 194fn clone_expand(
195 db: &dyn AstDatabase, 195 db: &dyn AstDatabase,
196 id: LazyMacroId, 196 id: MacroCallId,
197 tt: &tt::Subtree, 197 tt: &tt::Subtree,
198) -> Result<tt::Subtree, mbe::ExpandError> { 198) -> Result<tt::Subtree, mbe::ExpandError> {
199 let krate = find_builtin_crate(db, id); 199 let krate = find_builtin_crate(db, id);
@@ -202,7 +202,7 @@ fn clone_expand(
202 202
203fn default_expand( 203fn default_expand(
204 db: &dyn AstDatabase, 204 db: &dyn AstDatabase,
205 id: LazyMacroId, 205 id: MacroCallId,
206 tt: &tt::Subtree, 206 tt: &tt::Subtree,
207) -> Result<tt::Subtree, mbe::ExpandError> { 207) -> Result<tt::Subtree, mbe::ExpandError> {
208 let krate = find_builtin_crate(db, id); 208 let krate = find_builtin_crate(db, id);
@@ -211,7 +211,7 @@ fn default_expand(
211 211
212fn debug_expand( 212fn debug_expand(
213 db: &dyn AstDatabase, 213 db: &dyn AstDatabase,
214 id: LazyMacroId, 214 id: MacroCallId,
215 tt: &tt::Subtree, 215 tt: &tt::Subtree,
216) -> Result<tt::Subtree, mbe::ExpandError> { 216) -> Result<tt::Subtree, mbe::ExpandError> {
217 let krate = find_builtin_crate(db, id); 217 let krate = find_builtin_crate(db, id);
@@ -220,7 +220,7 @@ fn debug_expand(
220 220
221fn hash_expand( 221fn hash_expand(
222 db: &dyn AstDatabase, 222 db: &dyn AstDatabase,
223 id: LazyMacroId, 223 id: MacroCallId,
224 tt: &tt::Subtree, 224 tt: &tt::Subtree,
225) -> Result<tt::Subtree, mbe::ExpandError> { 225) -> Result<tt::Subtree, mbe::ExpandError> {
226 let krate = find_builtin_crate(db, id); 226 let krate = find_builtin_crate(db, id);
@@ -229,7 +229,7 @@ fn hash_expand(
229 229
230fn eq_expand( 230fn eq_expand(
231 db: &dyn AstDatabase, 231 db: &dyn AstDatabase,
232 id: LazyMacroId, 232 id: MacroCallId,
233 tt: &tt::Subtree, 233 tt: &tt::Subtree,
234) -> Result<tt::Subtree, mbe::ExpandError> { 234) -> Result<tt::Subtree, mbe::ExpandError> {
235 let krate = find_builtin_crate(db, id); 235 let krate = find_builtin_crate(db, id);
@@ -238,7 +238,7 @@ fn eq_expand(
238 238
239fn partial_eq_expand( 239fn partial_eq_expand(
240 db: &dyn AstDatabase, 240 db: &dyn AstDatabase,
241 id: LazyMacroId, 241 id: MacroCallId,
242 tt: &tt::Subtree, 242 tt: &tt::Subtree,
243) -> Result<tt::Subtree, mbe::ExpandError> { 243) -> Result<tt::Subtree, mbe::ExpandError> {
244 let krate = find_builtin_crate(db, id); 244 let krate = find_builtin_crate(db, id);
@@ -247,7 +247,7 @@ fn partial_eq_expand(
247 247
248fn ord_expand( 248fn ord_expand(
249 db: &dyn AstDatabase, 249 db: &dyn AstDatabase,
250 id: LazyMacroId, 250 id: MacroCallId,
251 tt: &tt::Subtree, 251 tt: &tt::Subtree,
252) -> Result<tt::Subtree, mbe::ExpandError> { 252) -> Result<tt::Subtree, mbe::ExpandError> {
253 let krate = find_builtin_crate(db, id); 253 let krate = find_builtin_crate(db, id);
@@ -256,7 +256,7 @@ fn ord_expand(
256 256
257fn partial_ord_expand( 257fn partial_ord_expand(
258 db: &dyn AstDatabase, 258 db: &dyn AstDatabase,
259 id: LazyMacroId, 259 id: MacroCallId,
260 tt: &tt::Subtree, 260 tt: &tt::Subtree,
261) -> Result<tt::Subtree, mbe::ExpandError> { 261) -> Result<tt::Subtree, mbe::ExpandError> {
262 let krate = find_builtin_crate(db, id); 262 let krate = find_builtin_crate(db, id);
@@ -317,6 +317,7 @@ $0
317 local_inner: false, 317 local_inner: false,
318 }, 318 },
319 krate: CrateId(0), 319 krate: CrateId(0),
320 eager: None,
320 kind: MacroCallKind::Derive { 321 kind: MacroCallKind::Derive {
321 ast_id, 322 ast_id,
322 derive_name: name.to_string(), 323 derive_name: name.to_string(),