Closed
Description
Pull request #36354 broke the spans for top-level attributes.
Self-contained example (that used to work):
#![feature(rustc_private)]
extern crate syntax;
use syntax::parse::{self, ParseSess};
fn main() {
let session = ParseSess::new();
let mut parser = parse::new_parser_from_source_str(&session, vec![], "".into(), "#[test]".into());
let attr = parser.parse_attribute(false).unwrap();
assert_eq!(attr.span.lo.0, 0);
assert_eq!(attr.span.hi.0, 7);
}
Now I get:
thread 'main' panicked at 'assertion failed: `(left == right)` (left: `6`, right: `7`)', test.rs:12
So the generated spans are one byte too short.
Meta
rustc 1.13.0-nightly (6ffdda1ba 2016-09-14)
binary: rustc
commit-hash: 6ffdda1ba183c981d57e63b59c88184be449eee4
commit-date: 2016-09-14
host: x86_64-unknown-linux-gnu
release: 1.13.0-nightly