diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-17 13:46:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-17 13:46:11 +0200 |
| commit | accc6e7e4aea2ca6482d27766e89549a4890e07a (patch) | |
| tree | da3ce96edd11e1adbf73aed3648260a25a5c0975 /src/libsyntax/parse/parser/ty.rs | |
| parent | 55f2ac2483531977f4b1b9f79753b0f9c82bbc16 (diff) | |
| parent | 8ca16ddfd4d92b4aca970478eeffa4d1e5fe30be (diff) | |
| download | rust-accc6e7e4aea2ca6482d27766e89549a4890e07a.tar.gz rust-accc6e7e4aea2ca6482d27766e89549a4890e07a.zip | |
Rollup merge of #65465 - Centril:split-syntax-1, r=petrochenkov
Move syntax::ext to a syntax_expand and refactor some attribute logic Part of https://github.com/rust-lang/rust/pull/65324. r? @petrochenkov
Diffstat (limited to 'src/libsyntax/parse/parser/ty.rs')
| -rw-r--r-- | src/libsyntax/parse/parser/ty.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser/ty.rs b/src/libsyntax/parse/parser/ty.rs index e696ab0804d..86c94b680b2 100644 --- a/src/libsyntax/parse/parser/ty.rs +++ b/src/libsyntax/parse/parser/ty.rs @@ -210,7 +210,7 @@ impl<'a> Parser<'a> { }; let span = lo.to(self.prev_span); - let ty = P(Ty { kind, span, id: ast::DUMMY_NODE_ID }); + let ty = self.mk_ty(span, kind); // Try to recover from use of `+` with incorrect priority. self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty); @@ -296,7 +296,7 @@ impl<'a> Parser<'a> { }))) } - crate fn parse_generic_bounds(&mut self, + pub(super) fn parse_generic_bounds(&mut self, colon_span: Option<Span>) -> PResult<'a, GenericBounds> { self.parse_generic_bounds_common(true, colon_span) } @@ -433,13 +433,13 @@ impl<'a> Parser<'a> { } } - crate fn check_lifetime(&mut self) -> bool { + pub fn check_lifetime(&mut self) -> bool { self.expected_tokens.push(TokenType::Lifetime); self.token.is_lifetime() } /// Parses a single lifetime `'a` or panics. - crate fn expect_lifetime(&mut self) -> Lifetime { + pub fn expect_lifetime(&mut self) -> Lifetime { if let Some(ident) = self.token.lifetime() { let span = self.token.span; self.bump(); @@ -448,4 +448,8 @@ impl<'a> Parser<'a> { self.span_bug(self.token.span, "not a lifetime") } } + + pub(super) fn mk_ty(&self, span: Span, kind: TyKind) -> P<Ty> { + P(Ty { kind, span, id: ast::DUMMY_NODE_ID }) + } } |
