Skip to content

Commit d6aee61

Browse files
authored
Rollup merge of rust-lang#36539 - mikhail-m1:36530, r=jonathandturner
fix top level attr spans issue rust-lang#36530 ?r @jonathandturner
2 parents a957604 + 82639d4 commit d6aee61

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/libsyntax/parse/attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ impl<'a> Parser<'a> {
125125

126126
self.expect(&token::OpenDelim(token::Bracket))?;
127127
let meta_item = self.parse_meta_item()?;
128-
let hi = self.last_span.hi;
129128
self.expect(&token::CloseDelim(token::Bracket))?;
129+
let hi = self.last_span.hi;
130130

131131
(mk_sp(lo, hi), meta_item, style)
132132
}

src/test/ui/span/issue-36530.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[foo]
12+
mod foo {
13+
#![foo]
14+
}

src/test/ui/span/issue-36530.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
2+
--> $DIR/issue-36530.rs:11:1
3+
|
4+
11 | #[foo]
5+
| ^^^^^^
6+
|
7+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
9+
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
10+
--> $DIR/issue-36530.rs:13:5
11+
|
12+
13 | #![foo]
13+
| ^^^^^^^
14+
|
15+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
18+

0 commit comments

Comments
 (0)