about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-05-22 22:55:48 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2014-05-22 22:58:14 +1000
commitd3fde8476b9cdce734dcec6b2003a482c5908235 (patch)
tree7b526f49487c5cff605b39377b55bfe878d3508a /src/libsyntax/parse
parent37bd466e5898da17f474628461abdd023c4d6a4d (diff)
downloadrust-d3fde8476b9cdce734dcec6b2003a482c5908235.tar.gz
rust-d3fde8476b9cdce734dcec6b2003a482c5908235.zip
syntax: put the correct span on doc-comments inside a module.
The position of the .bump call (before extracting the span fields) was
causing a doc-comment to have the span of the next token, not itself.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 80ee459a62d..ef0004d6ee0 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use ast;
-use codemap::{spanned, Spanned, mk_sp};
+use codemap::{spanned, Spanned, mk_sp, Span};
 use parse::common::*; //resolve bug?
 use parse::token;
 use parse::parser::Parser;
@@ -129,10 +129,10 @@ impl<'a> ParserAttr for Parser<'a> {
                     self.parse_attribute(true)
                 }
                 token::DOC_COMMENT(s) => {
+                    // we need to get the position of this token before we bump.
+                    let Span { lo, hi, .. } = self.span;
                     self.bump();
-                    ::attr::mk_sugared_doc_attr(self.id_to_interned_str(s),
-                                                self.span.lo,
-                                                self.span.hi)
+                    ::attr::mk_sugared_doc_attr(self.id_to_interned_str(s), lo, hi)
                 }
                 _ => {
                     break;