@@ -23,11 +23,12 @@ use syntax::codemap::Span;
23
23
pub struct CrateData {
24
24
pub name : String ,
25
25
pub number : u32 ,
26
+ pub span : Span ,
26
27
}
27
28
28
29
/// Data for any entity in the Rust language. The actual data contained varies
29
30
/// with the kind of entity being queried. See the nested structs for details.
30
- #[ derive( Debug ) ]
31
+ #[ derive( Debug , RustcEncodable ) ]
31
32
pub enum Data {
32
33
/// Data for Enums.
33
34
EnumData ( EnumData ) ,
@@ -79,22 +80,24 @@ pub enum Data {
79
80
}
80
81
81
82
/// Data for the prelude of a crate.
82
- #[ derive( Debug ) ]
83
+ #[ derive( Debug , RustcEncodable ) ]
83
84
pub struct CratePreludeData {
84
85
pub crate_name : String ,
85
- pub crate_root : Option < String > ,
86
- pub external_crates : Vec < ExternalCrateData >
86
+ pub crate_root : String ,
87
+ pub external_crates : Vec < ExternalCrateData > ,
88
+ pub span : Span ,
87
89
}
88
90
89
91
/// Data for external crates in the prelude of a crate.
90
- #[ derive( Debug ) ]
92
+ #[ derive( Debug , RustcEncodable ) ]
91
93
pub struct ExternalCrateData {
92
94
pub name : String ,
93
- pub num : CrateNum
95
+ pub num : CrateNum ,
96
+ pub file_name : String ,
94
97
}
95
98
96
99
/// Data for enum declarations.
97
- #[ derive( Clone , Debug ) ]
100
+ #[ derive( Clone , Debug , RustcEncodable ) ]
98
101
pub struct EnumData {
99
102
pub id : NodeId ,
100
103
pub value : String ,
@@ -104,7 +107,7 @@ pub struct EnumData {
104
107
}
105
108
106
109
/// Data for extern crates.
107
- #[ derive( Debug ) ]
110
+ #[ derive( Debug , RustcEncodable ) ]
108
111
pub struct ExternCrateData {
109
112
pub id : NodeId ,
110
113
pub name : String ,
@@ -115,15 +118,15 @@ pub struct ExternCrateData {
115
118
}
116
119
117
120
/// Data about a function call.
118
- #[ derive( Debug ) ]
121
+ #[ derive( Debug , RustcEncodable ) ]
119
122
pub struct FunctionCallData {
120
123
pub span : Span ,
121
124
pub scope : NodeId ,
122
125
pub ref_id : DefId ,
123
126
}
124
127
125
128
/// Data for all kinds of functions and methods.
126
- #[ derive( Clone , Debug ) ]
129
+ #[ derive( Clone , Debug , RustcEncodable ) ]
127
130
pub struct FunctionData {
128
131
pub id : NodeId ,
129
132
pub name : String ,
@@ -134,14 +137,14 @@ pub struct FunctionData {
134
137
}
135
138
136
139
/// Data about a function call.
137
- #[ derive( Debug ) ]
140
+ #[ derive( Debug , RustcEncodable ) ]
138
141
pub struct FunctionRefData {
139
142
pub span : Span ,
140
143
pub scope : NodeId ,
141
144
pub ref_id : DefId ,
142
145
}
143
146
144
- #[ derive( Debug ) ]
147
+ #[ derive( Debug , RustcEncodable ) ]
145
148
pub struct ImplData {
146
149
pub id : NodeId ,
147
150
pub span : Span ,
@@ -150,7 +153,7 @@ pub struct ImplData {
150
153
pub self_ref : Option < DefId > ,
151
154
}
152
155
153
- #[ derive( Debug ) ]
156
+ #[ derive( Debug , RustcEncodable ) ]
154
157
// FIXME: this struct should not exist. However, removing it requires heavy
155
158
// refactoring of dump_visitor.rs. See PR 31838 for more info.
156
159
pub struct ImplData2 {
@@ -164,23 +167,23 @@ pub struct ImplData2 {
164
167
pub self_ref : Option < TypeRefData > ,
165
168
}
166
169
167
- #[ derive( Debug ) ]
170
+ #[ derive( Debug , RustcEncodable ) ]
168
171
pub struct InheritanceData {
169
172
pub span : Span ,
170
173
pub base_id : DefId ,
171
174
pub deriv_id : NodeId
172
175
}
173
176
174
177
/// Data about a macro declaration.
175
- #[ derive( Debug ) ]
178
+ #[ derive( Debug , RustcEncodable ) ]
176
179
pub struct MacroData {
177
180
pub span : Span ,
178
181
pub name : String ,
179
182
pub qualname : String ,
180
183
}
181
184
182
185
/// Data about a macro use.
183
- #[ derive( Debug ) ]
186
+ #[ derive( Debug , RustcEncodable ) ]
184
187
pub struct MacroUseData {
185
188
pub span : Span ,
186
189
pub name : String ,
@@ -193,7 +196,7 @@ pub struct MacroUseData {
193
196
}
194
197
195
198
/// Data about a method call.
196
- #[ derive( Debug ) ]
199
+ #[ derive( Debug , RustcEncodable ) ]
197
200
pub struct MethodCallData {
198
201
pub span : Span ,
199
202
pub scope : NodeId ,
@@ -202,7 +205,7 @@ pub struct MethodCallData {
202
205
}
203
206
204
207
/// Data for method declarations (methods with a body are treated as functions).
205
- #[ derive( Clone , Debug ) ]
208
+ #[ derive( Clone , Debug , RustcEncodable ) ]
206
209
pub struct MethodData {
207
210
pub id : NodeId ,
208
211
pub qualname : String ,
@@ -211,7 +214,7 @@ pub struct MethodData {
211
214
}
212
215
213
216
/// Data for modules.
214
- #[ derive( Debug ) ]
217
+ #[ derive( Debug , RustcEncodable ) ]
215
218
pub struct ModData {
216
219
pub id : NodeId ,
217
220
pub name : String ,
@@ -222,15 +225,15 @@ pub struct ModData {
222
225
}
223
226
224
227
/// Data for a reference to a module.
225
- #[ derive( Debug ) ]
228
+ #[ derive( Debug , RustcEncodable ) ]
226
229
pub struct ModRefData {
227
230
pub span : Span ,
228
231
pub scope : NodeId ,
229
232
pub ref_id : Option < DefId > ,
230
233
pub qualname : String
231
234
}
232
235
233
- #[ derive( Debug ) ]
236
+ #[ derive( Debug , RustcEncodable ) ]
234
237
pub struct StructData {
235
238
pub span : Span ,
236
239
pub id : NodeId ,
@@ -240,7 +243,7 @@ pub struct StructData {
240
243
pub value : String
241
244
}
242
245
243
- #[ derive( Debug ) ]
246
+ #[ derive( Debug , RustcEncodable ) ]
244
247
pub struct StructVariantData {
245
248
pub span : Span ,
246
249
pub id : NodeId ,
@@ -250,7 +253,7 @@ pub struct StructVariantData {
250
253
pub scope : NodeId
251
254
}
252
255
253
- #[ derive( Debug ) ]
256
+ #[ derive( Debug , RustcEncodable ) ]
254
257
pub struct TraitData {
255
258
pub span : Span ,
256
259
pub id : NodeId ,
@@ -259,7 +262,7 @@ pub struct TraitData {
259
262
pub value : String
260
263
}
261
264
262
- #[ derive( Debug ) ]
265
+ #[ derive( Debug , RustcEncodable ) ]
263
266
pub struct TupleVariantData {
264
267
pub span : Span ,
265
268
pub id : NodeId ,
@@ -271,7 +274,7 @@ pub struct TupleVariantData {
271
274
}
272
275
273
276
/// Data for a typedef.
274
- #[ derive( Debug ) ]
277
+ #[ derive( Debug , RustcEncodable ) ]
275
278
pub struct TypedefData {
276
279
pub id : NodeId ,
277
280
pub span : Span ,
@@ -280,15 +283,15 @@ pub struct TypedefData {
280
283
}
281
284
282
285
/// Data for a reference to a type or trait.
283
- #[ derive( Clone , Debug ) ]
286
+ #[ derive( Clone , Debug , RustcEncodable ) ]
284
287
pub struct TypeRefData {
285
288
pub span : Span ,
286
289
pub scope : NodeId ,
287
290
pub ref_id : Option < DefId > ,
288
291
pub qualname : String ,
289
292
}
290
293
291
- #[ derive( Debug ) ]
294
+ #[ derive( Debug , RustcEncodable ) ]
292
295
pub struct UseData {
293
296
pub id : NodeId ,
294
297
pub span : Span ,
@@ -297,7 +300,7 @@ pub struct UseData {
297
300
pub scope : NodeId
298
301
}
299
302
300
- #[ derive( Debug ) ]
303
+ #[ derive( Debug , RustcEncodable ) ]
301
304
pub struct UseGlobData {
302
305
pub id : NodeId ,
303
306
pub span : Span ,
@@ -306,7 +309,7 @@ pub struct UseGlobData {
306
309
}
307
310
308
311
/// Data for local and global variables (consts and statics).
309
- #[ derive( Debug ) ]
312
+ #[ derive( Debug , RustcEncodable ) ]
310
313
pub struct VariableData {
311
314
pub id : NodeId ,
312
315
pub name : String ,
@@ -319,7 +322,7 @@ pub struct VariableData {
319
322
320
323
/// Data for the use of some item (e.g., the use of a local variable, which
321
324
/// will refer to that variables declaration (by ref_id)).
322
- #[ derive( Debug ) ]
325
+ #[ derive( Debug , RustcEncodable ) ]
323
326
pub struct VariableRefData {
324
327
pub name : String ,
325
328
pub span : Span ,
0 commit comments