diff options
| author | bors <bors@rust-lang.org> | 2014-05-22 20:56:18 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-22 20:56:18 -0700 |
| commit | 02117dd1bc10c65ca1f56fd81996a573c88ccfd5 (patch) | |
| tree | 37eef5dbc14141cacc83d97e025cc398a85f7508 /src/libsyntax/parse | |
| parent | ec0258a381b88b5574e3f8ce72ae553ac3a574b7 (diff) | |
| parent | d3fde8476b9cdce734dcec6b2003a482c5908235 (diff) | |
| download | rust-02117dd1bc10c65ca1f56fd81996a573c88ccfd5.tar.gz rust-02117dd1bc10c65ca1f56fd81996a573c88ccfd5.zip | |
auto merge of #14357 : huonw/rust/spelling, r=pnkfelix
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`.
```rust
//! a
//! b
fn bar() {}
```
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 6f17412fa63..89d1b8f9342 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; |
