diff options
| author | bors <bors@rust-lang.org> | 2015-07-21 09:59:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-21 09:59:18 +0000 |
| commit | e33b128e01e1a5a2d23abac5b88274eea5cf9059 (patch) | |
| tree | d0da3b98226376b52150853f61b4faee90446dc4 /src/libsyntax/parse/parser.rs | |
| parent | 247a0d185446fb145e1e5843c44c97b9a564e135 (diff) | |
| parent | f47d20aecdcd7db34d41ad1666fd3eee095cc943 (diff) | |
| download | rust-e33b128e01e1a5a2d23abac5b88274eea5cf9059.tar.gz rust-e33b128e01e1a5a2d23abac5b88274eea5cf9059.zip | |
Auto merge of #26816 - nrc:zero-codemap, r=@jroesch
See commits for details
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 28802d323c6..db1b2489f1d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4824,8 +4824,14 @@ impl<'a> Parser<'a> { return Err(self.fatal(&format!("expected item, found `{}`", token_str))); } + let hi = if self.span == codemap::DUMMY_SP { + inner_lo + } else { + self.span.lo + }; + Ok(ast::Mod { - inner: mk_sp(inner_lo, self.span.lo), + inner: mk_sp(inner_lo, hi), items: items }) } @@ -4869,8 +4875,7 @@ impl<'a> Parser<'a> { fn push_mod_path(&mut self, id: Ident, attrs: &[Attribute]) { let default_path = self.id_to_interned_str(id); - let file_path = match ::attr::first_attr_value_str_by_name(attrs, - "path") { + let file_path = match ::attr::first_attr_value_str_by_name(attrs, "path") { Some(d) => d, None => default_path, }; @@ -5003,13 +5008,12 @@ impl<'a> Parser<'a> { included_mod_stack.push(path.clone()); drop(included_mod_stack); - let mut p0 = - new_sub_parser_from_file(self.sess, - self.cfg.clone(), - &path, - owns_directory, - Some(name), - id_sp); + let mut p0 = new_sub_parser_from_file(self.sess, + self.cfg.clone(), + &path, + owns_directory, + Some(name), + id_sp); let mod_inner_lo = p0.span.lo; let mod_attrs = p0.parse_inner_attributes(); let m0 = try!(p0.parse_mod_items(&token::Eof, mod_inner_lo)); |
