@@ -26,6 +26,8 @@ use std::num::ToPrimitive;
2626use std:: ops:: { Add , Sub } ;
2727use std:: rc:: Rc ;
2828
29+ use std:: fmt;
30+
2931use libc:: c_uint;
3032use serialize:: { Encodable , Decodable , Encoder , Decoder } ;
3133
@@ -199,6 +201,7 @@ pub fn original_sp(cm: &CodeMap, sp: Span, enclosing_sp: Span) -> Span {
199201//
200202
201203/// A source code location used for error reporting
204+ #[ derive( Debug ) ]
202205pub struct Loc {
203206 /// Information about the original source
204207 pub file : Rc < FileMap > ,
@@ -211,6 +214,7 @@ pub struct Loc {
211214/// A source code location used as the result of lookup_char_pos_adj
212215// Actually, *none* of the clients use the filename *or* file field;
213216// perhaps they should just be removed.
217+ #[ derive( Debug ) ]
214218pub struct LocWithOpt {
215219 pub filename : FileName ,
216220 pub line : usize ,
@@ -219,7 +223,9 @@ pub struct LocWithOpt {
219223}
220224
221225// used to be structural records. Better names, anyone?
226+ #[ derive( Debug ) ]
222227pub struct FileMapAndLine { pub fm : Rc < FileMap > , pub line : usize }
228+ #[ derive( Debug ) ]
223229pub struct FileMapAndBytePos { pub fm : Rc < FileMap > , pub pos : BytePos }
224230
225231
@@ -449,6 +455,12 @@ impl Decodable for FileMap {
449455 }
450456}
451457
458+ impl fmt:: Debug for FileMap {
459+ fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
460+ write ! ( fmt, "FileMap({})" , self . name)
461+ }
462+ }
463+
452464impl FileMap {
453465 /// EFFECT: register a start-of-line offset in the
454466 /// table of line-beginnings.
0 commit comments