Skip to content

Commit bc2c678

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 169470 b: refs/heads/master c: e2a9c04 h: refs/heads/master v: v3
1 parent b5c3c7d commit bc2c678

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: ad7c64777380a780b42028855ad0d09932a11623
2+
refs/heads/master: e2a9c04e192926fde1a8e886b55e4c2b6e0e56cb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb

trunk/src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5973,6 +5973,10 @@ impl<'a> Parser<'a> {
59735973
fn parse_view_path(&mut self) -> P<ViewPath> {
59745974
let lo = self.span.lo;
59755975

5976+
// Allow a leading :: because the paths are absolute either way.
5977+
// This occurs with "use $crate::..." in macros.
5978+
self.eat(&token::ModSep);
5979+
59765980
if self.check(&token::OpenDelim(token::Brace)) {
59775981
// use {foo,bar}
59785982
let idents = self.parse_unspanned_seq(
Lines changed: 14 additions & 0 deletions
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+
fn main() {
12+
use ::std::mem;
13+
mem::drop(2u);
14+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
#![feature(macro_rules)]
12+
13+
pub fn increment(x: uint) -> uint {
14+
x + 1
15+
}
16+
17+
#[macro_export]
18+
macro_rules! increment {
19+
($x:expr) => ({
20+
use $crate::increment;
21+
increment($x)
22+
})
23+
}
24+
25+
fn main() {
26+
assert_eq!(increment!(3), 4);
27+
}

0 commit comments

Comments
 (0)