diff options
| author | bors <bors@rust-lang.org> | 2015-04-09 20:38:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-09 20:38:36 +0000 |
| commit | 88fc543866c2c48b3b1a32e9d55a4eb77d1dee66 (patch) | |
| tree | cfb472437aefde7eab3e8e034c5dbb45c8f0f7c2 /src/libsyntax | |
| parent | e326aa197b1ee35b41c992eec171589197a7459d (diff) | |
| parent | ea731797b821c3347be72fefcba32d48e04d27d0 (diff) | |
| download | rust-88fc543866c2c48b3b1a32e9d55a4eb77d1dee66.tar.gz rust-88fc543866c2c48b3b1a32e9d55a4eb77d1dee66.zip | |
Auto merge of #24232 - Manishearth:rollup, r=Manishearth
None
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index b563a5e7d6e..56af43474a6 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -26,6 +26,8 @@ use std::num::ToPrimitive; use std::ops::{Add, Sub}; use std::rc::Rc; +use std::fmt; + use libc::c_uint; use serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -199,6 +201,7 @@ pub fn original_sp(cm: &CodeMap, sp: Span, enclosing_sp: Span) -> Span { // /// A source code location used for error reporting +#[derive(Debug)] pub struct Loc { /// Information about the original source pub file: Rc<FileMap>, @@ -211,6 +214,7 @@ pub struct Loc { /// A source code location used as the result of lookup_char_pos_adj // Actually, *none* of the clients use the filename *or* file field; // perhaps they should just be removed. +#[derive(Debug)] pub struct LocWithOpt { pub filename: FileName, pub line: usize, @@ -219,7 +223,9 @@ pub struct LocWithOpt { } // used to be structural records. Better names, anyone? +#[derive(Debug)] pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: usize } +#[derive(Debug)] pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos } @@ -449,6 +455,12 @@ impl Decodable for FileMap { } } +impl fmt::Debug for FileMap { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "FileMap({})", self.name) + } +} + impl FileMap { /// EFFECT: register a start-of-line offset in the /// table of line-beginnings. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 272bb5f6506..3cc16006b1b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2880,7 +2880,7 @@ impl<'a> Parser<'a> { try!(self.expect_keyword(keywords::In)); let expr = try!(self.parse_expr_res(RESTRICTION_NO_STRUCT_LITERAL)); let loop_block = try!(self.parse_block()); - let hi = self.span.hi; + let hi = self.last_span.hi; Ok(self.mk_expr(lo, hi, ExprForLoop(pat, expr, loop_block, opt_ident))) } |
