@@ -9,7 +9,7 @@ use ra_syntax::{
9
9
} ;
10
10
11
11
use crate :: db:: AstDatabase ;
12
- use crate :: { name, quote, MacroCallId , MacroDefId , MacroDefKind } ;
12
+ use crate :: { name, quote, LazyMacroId , MacroDefId , MacroDefKind } ;
13
13
14
14
macro_rules! register_builtin {
15
15
( $( $trait: ident => $expand: ident) ,* ) => {
@@ -22,7 +22,7 @@ macro_rules! register_builtin {
22
22
pub fn expand(
23
23
& self ,
24
24
db: & dyn AstDatabase ,
25
- id: MacroCallId ,
25
+ id: LazyMacroId ,
26
26
tt: & tt:: Subtree ,
27
27
) -> Result <tt:: Subtree , mbe:: ExpandError > {
28
28
let expander = match * self {
@@ -155,71 +155,71 @@ fn expand_simple_derive(
155
155
156
156
fn copy_expand (
157
157
_db : & dyn AstDatabase ,
158
- _id : MacroCallId ,
158
+ _id : LazyMacroId ,
159
159
tt : & tt:: Subtree ,
160
160
) -> Result < tt:: Subtree , mbe:: ExpandError > {
161
161
expand_simple_derive ( tt, quote ! { std:: marker:: Copy } )
162
162
}
163
163
164
164
fn clone_expand (
165
165
_db : & dyn AstDatabase ,
166
- _id : MacroCallId ,
166
+ _id : LazyMacroId ,
167
167
tt : & tt:: Subtree ,
168
168
) -> Result < tt:: Subtree , mbe:: ExpandError > {
169
169
expand_simple_derive ( tt, quote ! { std:: clone:: Clone } )
170
170
}
171
171
172
172
fn default_expand (
173
173
_db : & dyn AstDatabase ,
174
- _id : MacroCallId ,
174
+ _id : LazyMacroId ,
175
175
tt : & tt:: Subtree ,
176
176
) -> Result < tt:: Subtree , mbe:: ExpandError > {
177
177
expand_simple_derive ( tt, quote ! { std:: default :: Default } )
178
178
}
179
179
180
180
fn debug_expand (
181
181
_db : & dyn AstDatabase ,
182
- _id : MacroCallId ,
182
+ _id : LazyMacroId ,
183
183
tt : & tt:: Subtree ,
184
184
) -> Result < tt:: Subtree , mbe:: ExpandError > {
185
185
expand_simple_derive ( tt, quote ! { std:: fmt:: Debug } )
186
186
}
187
187
188
188
fn hash_expand (
189
189
_db : & dyn AstDatabase ,
190
- _id : MacroCallId ,
190
+ _id : LazyMacroId ,
191
191
tt : & tt:: Subtree ,
192
192
) -> Result < tt:: Subtree , mbe:: ExpandError > {
193
193
expand_simple_derive ( tt, quote ! { std:: hash:: Hash } )
194
194
}
195
195
196
196
fn eq_expand (
197
197
_db : & dyn AstDatabase ,
198
- _id : MacroCallId ,
198
+ _id : LazyMacroId ,
199
199
tt : & tt:: Subtree ,
200
200
) -> Result < tt:: Subtree , mbe:: ExpandError > {
201
201
expand_simple_derive ( tt, quote ! { std:: cmp:: Eq } )
202
202
}
203
203
204
204
fn partial_eq_expand (
205
205
_db : & dyn AstDatabase ,
206
- _id : MacroCallId ,
206
+ _id : LazyMacroId ,
207
207
tt : & tt:: Subtree ,
208
208
) -> Result < tt:: Subtree , mbe:: ExpandError > {
209
209
expand_simple_derive ( tt, quote ! { std:: cmp:: PartialEq } )
210
210
}
211
211
212
212
fn ord_expand (
213
213
_db : & dyn AstDatabase ,
214
- _id : MacroCallId ,
214
+ _id : LazyMacroId ,
215
215
tt : & tt:: Subtree ,
216
216
) -> Result < tt:: Subtree , mbe:: ExpandError > {
217
217
expand_simple_derive ( tt, quote ! { std:: cmp:: Ord } )
218
218
}
219
219
220
220
fn partial_ord_expand (
221
221
_db : & dyn AstDatabase ,
222
- _id : MacroCallId ,
222
+ _id : LazyMacroId ,
223
223
tt : & tt:: Subtree ,
224
224
) -> Result < tt:: Subtree , mbe:: ExpandError > {
225
225
expand_simple_derive ( tt, quote ! { std:: cmp:: PartialOrd } )
@@ -228,7 +228,7 @@ fn partial_ord_expand(
228
228
#[ cfg( test) ]
229
229
mod tests {
230
230
use super :: * ;
231
- use crate :: { test_db:: TestDB , AstId , MacroCallKind , MacroCallLoc } ;
231
+ use crate :: { test_db:: TestDB , AstId , MacroCallId , MacroCallKind , MacroCallLoc } ;
232
232
use ra_db:: { fixture:: WithFixture , SourceDatabase } ;
233
233
234
234
fn expand_builtin_derive ( s : & str , expander : BuiltinDeriveExpander ) -> String {
@@ -248,7 +248,7 @@ mod tests {
248
248
kind : MacroCallKind :: Attr ( AstId :: new ( file_id. into ( ) , ast_id_map. ast_id ( & items[ 0 ] ) ) ) ,
249
249
} ;
250
250
251
- let id = db. intern_macro ( loc) ;
251
+ let id: MacroCallId = db. intern_macro ( loc) . into ( ) ;
252
252
let parsed = db. parse_or_expand ( id. as_file ( ) ) . unwrap ( ) ;
253
253
254
254
// FIXME text() for syntax nodes parsed from token tree looks weird
0 commit comments