Skip to content

Commit 27ecaa2

Browse files
committed
Rollup merge of #24221 - nrc:debug-loc, r=sfackler
2 parents b389207 + 613cf9a commit 27ecaa2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libsyntax/codemap.rs

+12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ use std::num::ToPrimitive;
2626
use std::ops::{Add, Sub};
2727
use std::rc::Rc;
2828

29+
use std::fmt;
30+
2931
use libc::c_uint;
3032
use 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)]
202205
pub 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)]
214218
pub 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)]
222227
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: usize }
228+
#[derive(Debug)]
223229
pub 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+
452464
impl FileMap {
453465
/// EFFECT: register a start-of-line offset in the
454466
/// table of line-beginnings.

0 commit comments

Comments
 (0)