Skip to content

Commit 3e0a5b9

Browse files
committed
Oops, parse_type_path should be aware of macro-generated paths.
1 parent c2510fd commit 3e0a5b9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libsyntax/parse/parser.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1050,11 +1050,13 @@ impl Parser {
10501050
// Like the above, but can also parse kind bounds in the case of a
10511051
// path to be used as a type that might be a trait.
10521052
pub fn parse_type_path(&self) -> (@ast::Path, OptVec<TyParamBound>) {
1053-
let mut bounds = None;
1053+
let mut bounds = opt_vec::Empty;
10541054
let path = self.parse_bounded_path_with_tps(false, Some(|| {
1055-
bounds = Some(self.parse_optional_ty_param_bounds());
1055+
// Note: this closure might not even get called in the case of a
1056+
// macro-generated path. But that's the macro parser's job.
1057+
bounds = self.parse_optional_ty_param_bounds();
10561058
}));
1057-
(path, bounds.unwrap())
1059+
(path, bounds)
10581060
}
10591061

10601062
/// parses 0 or 1 lifetime

0 commit comments

Comments
 (0)