Skip to content

Commit bf49b3a

Browse files
committed
---
yaml --- r: 234755 b: refs/heads/tmp c: 25aaeb4 h: refs/heads/master i: 234753: 7414dc3 234751: ab616c5 v: v3
1 parent 49fcd6f commit bf49b3a

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: d7ec69a652e8e58c788c8dfa060387d1ceb4b28d
28+
refs/heads/tmp: 25aaeb40b11a5983ed6000a8e466c08a701dfb99
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5037,9 +5037,8 @@ impl<'a> Parser<'a> {
50375037
}
50385038

50395039
/// Parse a function declaration from a foreign module
5040-
fn parse_item_foreign_fn(&mut self, vis: ast::Visibility,
5040+
fn parse_item_foreign_fn(&mut self, vis: ast::Visibility, lo: BytePos,
50415041
attrs: Vec<Attribute>) -> PResult<P<ForeignItem>> {
5042-
let lo = self.span.lo;
50435042
try!(self.expect_keyword(keywords::Fn));
50445043

50455044
let (ident, mut generics) = try!(self.parse_fn_header());
@@ -5058,10 +5057,8 @@ impl<'a> Parser<'a> {
50585057
}
50595058

50605059
/// Parse a static item from a foreign module
5061-
fn parse_item_foreign_static(&mut self, vis: ast::Visibility,
5060+
fn parse_item_foreign_static(&mut self, vis: ast::Visibility, lo: BytePos,
50625061
attrs: Vec<Attribute>) -> PResult<P<ForeignItem>> {
5063-
let lo = self.span.lo;
5064-
50655062
try!(self.expect_keyword(keywords::Static));
50665063
let mutbl = try!(self.eat_keyword(keywords::Mut));
50675064

@@ -5557,11 +5554,11 @@ impl<'a> Parser<'a> {
55575554

55585555
if self.check_keyword(keywords::Static) {
55595556
// FOREIGN STATIC ITEM
5560-
return Ok(Some(try!(self.parse_item_foreign_static(visibility, attrs))));
5557+
return Ok(Some(try!(self.parse_item_foreign_static(visibility, lo, attrs))));
55615558
}
55625559
if self.check_keyword(keywords::Fn) || self.check_keyword(keywords::Unsafe) {
55635560
// FOREIGN FUNCTION ITEM
5564-
return Ok(Some(try!(self.parse_item_foreign_fn(visibility, attrs))));
5561+
return Ok(Some(try!(self.parse_item_foreign_fn(visibility, lo, attrs))));
55655562
}
55665563

55675564
// FIXME #5668: this will occur for a macro invocation:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2012-2015 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+
// Check that the visibility modifier is included in the span of foreign items.
12+
13+
extern {
14+
fn foo();
15+
16+
pub //~ ERROR duplicate definition
17+
fn foo();
18+
19+
pub //~ ERROR duplicate definition
20+
static mut foo: u32;
21+
}
22+
23+
fn main() {
24+
}

0 commit comments

Comments
 (0)