@@ -23,11 +23,12 @@ use syntax::codemap::Span;
2323pub struct CrateData {
2424 pub name : String ,
2525 pub number : u32 ,
26+ pub span : Span ,
2627}
2728
2829/// Data for any entity in the Rust language. The actual data contained varies
2930/// with the kind of entity being queried. See the nested structs for details.
30- #[ derive( Debug ) ]
31+ #[ derive( Debug , RustcEncodable ) ]
3132pub enum Data {
3233 /// Data for Enums.
3334 EnumData ( EnumData ) ,
@@ -79,22 +80,24 @@ pub enum Data {
7980}
8081
8182/// Data for the prelude of a crate.
82- #[ derive( Debug ) ]
83+ #[ derive( Debug , RustcEncodable ) ]
8384pub struct CratePreludeData {
8485 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 ,
8789}
8890
8991/// Data for external crates in the prelude of a crate.
90- #[ derive( Debug ) ]
92+ #[ derive( Debug , RustcEncodable ) ]
9193pub struct ExternalCrateData {
9294 pub name : String ,
93- pub num : CrateNum
95+ pub num : CrateNum ,
96+ pub file_name : String ,
9497}
9598
9699/// Data for enum declarations.
97- #[ derive( Clone , Debug ) ]
100+ #[ derive( Clone , Debug , RustcEncodable ) ]
98101pub struct EnumData {
99102 pub id : NodeId ,
100103 pub value : String ,
@@ -104,7 +107,7 @@ pub struct EnumData {
104107}
105108
106109/// Data for extern crates.
107- #[ derive( Debug ) ]
110+ #[ derive( Debug , RustcEncodable ) ]
108111pub struct ExternCrateData {
109112 pub id : NodeId ,
110113 pub name : String ,
@@ -115,15 +118,15 @@ pub struct ExternCrateData {
115118}
116119
117120/// Data about a function call.
118- #[ derive( Debug ) ]
121+ #[ derive( Debug , RustcEncodable ) ]
119122pub struct FunctionCallData {
120123 pub span : Span ,
121124 pub scope : NodeId ,
122125 pub ref_id : DefId ,
123126}
124127
125128/// Data for all kinds of functions and methods.
126- #[ derive( Clone , Debug ) ]
129+ #[ derive( Clone , Debug , RustcEncodable ) ]
127130pub struct FunctionData {
128131 pub id : NodeId ,
129132 pub name : String ,
@@ -134,14 +137,14 @@ pub struct FunctionData {
134137}
135138
136139/// Data about a function call.
137- #[ derive( Debug ) ]
140+ #[ derive( Debug , RustcEncodable ) ]
138141pub struct FunctionRefData {
139142 pub span : Span ,
140143 pub scope : NodeId ,
141144 pub ref_id : DefId ,
142145}
143146
144- #[ derive( Debug ) ]
147+ #[ derive( Debug , RustcEncodable ) ]
145148pub struct ImplData {
146149 pub id : NodeId ,
147150 pub span : Span ,
@@ -150,7 +153,7 @@ pub struct ImplData {
150153 pub self_ref : Option < DefId > ,
151154}
152155
153- #[ derive( Debug ) ]
156+ #[ derive( Debug , RustcEncodable ) ]
154157// FIXME: this struct should not exist. However, removing it requires heavy
155158// refactoring of dump_visitor.rs. See PR 31838 for more info.
156159pub struct ImplData2 {
@@ -164,23 +167,23 @@ pub struct ImplData2 {
164167 pub self_ref : Option < TypeRefData > ,
165168}
166169
167- #[ derive( Debug ) ]
170+ #[ derive( Debug , RustcEncodable ) ]
168171pub struct InheritanceData {
169172 pub span : Span ,
170173 pub base_id : DefId ,
171174 pub deriv_id : NodeId
172175}
173176
174177/// Data about a macro declaration.
175- #[ derive( Debug ) ]
178+ #[ derive( Debug , RustcEncodable ) ]
176179pub struct MacroData {
177180 pub span : Span ,
178181 pub name : String ,
179182 pub qualname : String ,
180183}
181184
182185/// Data about a macro use.
183- #[ derive( Debug ) ]
186+ #[ derive( Debug , RustcEncodable ) ]
184187pub struct MacroUseData {
185188 pub span : Span ,
186189 pub name : String ,
@@ -193,7 +196,7 @@ pub struct MacroUseData {
193196}
194197
195198/// Data about a method call.
196- #[ derive( Debug ) ]
199+ #[ derive( Debug , RustcEncodable ) ]
197200pub struct MethodCallData {
198201 pub span : Span ,
199202 pub scope : NodeId ,
@@ -202,7 +205,7 @@ pub struct MethodCallData {
202205}
203206
204207/// Data for method declarations (methods with a body are treated as functions).
205- #[ derive( Clone , Debug ) ]
208+ #[ derive( Clone , Debug , RustcEncodable ) ]
206209pub struct MethodData {
207210 pub id : NodeId ,
208211 pub qualname : String ,
@@ -211,7 +214,7 @@ pub struct MethodData {
211214}
212215
213216/// Data for modules.
214- #[ derive( Debug ) ]
217+ #[ derive( Debug , RustcEncodable ) ]
215218pub struct ModData {
216219 pub id : NodeId ,
217220 pub name : String ,
@@ -222,15 +225,15 @@ pub struct ModData {
222225}
223226
224227/// Data for a reference to a module.
225- #[ derive( Debug ) ]
228+ #[ derive( Debug , RustcEncodable ) ]
226229pub struct ModRefData {
227230 pub span : Span ,
228231 pub scope : NodeId ,
229232 pub ref_id : Option < DefId > ,
230233 pub qualname : String
231234}
232235
233- #[ derive( Debug ) ]
236+ #[ derive( Debug , RustcEncodable ) ]
234237pub struct StructData {
235238 pub span : Span ,
236239 pub id : NodeId ,
@@ -240,7 +243,7 @@ pub struct StructData {
240243 pub value : String
241244}
242245
243- #[ derive( Debug ) ]
246+ #[ derive( Debug , RustcEncodable ) ]
244247pub struct StructVariantData {
245248 pub span : Span ,
246249 pub id : NodeId ,
@@ -250,7 +253,7 @@ pub struct StructVariantData {
250253 pub scope : NodeId
251254}
252255
253- #[ derive( Debug ) ]
256+ #[ derive( Debug , RustcEncodable ) ]
254257pub struct TraitData {
255258 pub span : Span ,
256259 pub id : NodeId ,
@@ -259,7 +262,7 @@ pub struct TraitData {
259262 pub value : String
260263}
261264
262- #[ derive( Debug ) ]
265+ #[ derive( Debug , RustcEncodable ) ]
263266pub struct TupleVariantData {
264267 pub span : Span ,
265268 pub id : NodeId ,
@@ -271,7 +274,7 @@ pub struct TupleVariantData {
271274}
272275
273276/// Data for a typedef.
274- #[ derive( Debug ) ]
277+ #[ derive( Debug , RustcEncodable ) ]
275278pub struct TypedefData {
276279 pub id : NodeId ,
277280 pub span : Span ,
@@ -280,15 +283,15 @@ pub struct TypedefData {
280283}
281284
282285/// Data for a reference to a type or trait.
283- #[ derive( Clone , Debug ) ]
286+ #[ derive( Clone , Debug , RustcEncodable ) ]
284287pub struct TypeRefData {
285288 pub span : Span ,
286289 pub scope : NodeId ,
287290 pub ref_id : Option < DefId > ,
288291 pub qualname : String ,
289292}
290293
291- #[ derive( Debug ) ]
294+ #[ derive( Debug , RustcEncodable ) ]
292295pub struct UseData {
293296 pub id : NodeId ,
294297 pub span : Span ,
@@ -297,7 +300,7 @@ pub struct UseData {
297300 pub scope : NodeId
298301}
299302
300- #[ derive( Debug ) ]
303+ #[ derive( Debug , RustcEncodable ) ]
301304pub struct UseGlobData {
302305 pub id : NodeId ,
303306 pub span : Span ,
@@ -306,7 +309,7 @@ pub struct UseGlobData {
306309}
307310
308311/// Data for local and global variables (consts and statics).
309- #[ derive( Debug ) ]
312+ #[ derive( Debug , RustcEncodable ) ]
310313pub struct VariableData {
311314 pub id : NodeId ,
312315 pub name : String ,
@@ -319,7 +322,7 @@ pub struct VariableData {
319322
320323/// Data for the use of some item (e.g., the use of a local variable, which
321324/// will refer to that variables declaration (by ref_id)).
322- #[ derive( Debug ) ]
325+ #[ derive( Debug , RustcEncodable ) ]
323326pub struct VariableRefData {
324327 pub name : String ,
325328 pub span : Span ,
0 commit comments