diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-31 21:20:24 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-02-24 14:14:16 +0200 |
| commit | ffb8092ccf8dd186a9a03e6808d04a7276206793 (patch) | |
| tree | f9fab075f87149cc4ebbac0fed1e4ac90657c60c /src/libsyntax/parse | |
| parent | 326711e9bdee2e8f467ad716109b5a270b61478d (diff) | |
| download | rust-ffb8092ccf8dd186a9a03e6808d04a7276206793.tar.gz rust-ffb8092ccf8dd186a9a03e6808d04a7276206793.zip | |
syntax: use a single Path for Trait::Item in QPath.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b2f59725855..ad290da7d0a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1525,18 +1525,14 @@ impl<'a> Parser<'a> { // QUALIFIED PATH `<TYPE as TRAIT_REF>::item` let self_type = self.parse_ty_sum(); self.expect_keyword(keywords::As); - let trait_path = self.parse_path(LifetimeAndTypesWithoutColons); + let mut path = self.parse_path(LifetimeAndTypesWithoutColons); self.expect(&token::Gt); self.expect(&token::ModSep); - let item_name = self.parse_ident(); - TyQPath(P(QPath { - self_type: self_type, - trait_path: trait_path, - item_path: ast::PathSegment { - identifier: item_name, - parameters: ast::PathParameters::none() - } - })) + path.segments.push(ast::PathSegment { + identifier: self.parse_ident(), + parameters: ast::PathParameters::none() + }); + TyQPath(QPath { self_type: self_type, path: path }) } else if self.check(&token::ModSep) || self.token.is_ident() || self.token.is_path() { @@ -2220,7 +2216,7 @@ impl<'a> Parser<'a> { // QUALIFIED PATH `<TYPE as TRAIT_REF>::item::<'a, T>` let self_type = self.parse_ty_sum(); self.expect_keyword(keywords::As); - let trait_path = self.parse_path(LifetimeAndTypesWithoutColons); + let mut path = self.parse_path(LifetimeAndTypesWithoutColons); self.expect(&token::Gt); self.expect(&token::ModSep); let item_name = self.parse_ident(); @@ -2237,15 +2233,13 @@ impl<'a> Parser<'a> { } else { ast::PathParameters::none() }; + path.segments.push(ast::PathSegment { + identifier: item_name, + parameters: parameters + }); let hi = self.span.hi; - return self.mk_expr(lo, hi, ExprQPath(P(QPath { - self_type: self_type, - trait_path: trait_path, - item_path: ast::PathSegment { - identifier: item_name, - parameters: parameters - } - }))); + return self.mk_expr(lo, hi, + ExprQPath(QPath { self_type: self_type, path: path })); } if self.eat_keyword(keywords::Move) { return self.parse_lambda_expr(CaptureByValue); |
