Skip to content

Commit 9bed0dd

Browse files
committed
Fix parsing of interpolated paths
1 parent 371be3c commit 9bed0dd

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ impl Parser {
566566
self.parse_borrowed_pointee()
567567
} else if self.token_is_fn_keyword(self.token) {
568568
self.parse_ty_fn(None, None)
569-
} else if self.token == token::MOD_SEP || is_ident(self.token) {
569+
} else if self.token == token::MOD_SEP
570+
|| is_ident_or_path(self.token) {
570571
let path = self.parse_path_with_tps(colons_before_params);
571572
ty_path(path, self.get_id())
572573
} else { self.fatal(~"expected type"); };

src/test/run-pass/macro-path.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
mod m {
2+
pub type t = int;
3+
}
4+
5+
fn macros() {
6+
macro_rules! foo {
7+
($p:path) => {
8+
fn f() -> $p { 10 }
9+
f()
10+
}
11+
}
12+
}
13+
14+
fn main() {
15+
assert foo!(m::t) == 10;
16+
}

0 commit comments

Comments
 (0)