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() {}
```
This commit is contained in:
bors 2014-05-22 20:56:18 -07:00
commit 02117dd1bc
21 changed files with 35 additions and 33 deletions

View file

@ -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;