summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2019-08-03review commentsEsteban Küber-3/+4
2019-08-03Fix another caseEsteban Küber-3/+12
2019-08-03Make the parser TokenStream more resilient after mismatched delimiter recoveryEsteban Küber-0/+3
2019-07-22Rollup merge of #62792 - goodmanjonathan:beta, r=estebankPietro Albini-1/+1
2019-07-22Cancel unemitted diagnostics during error recoveryEsteban Küber-8/+9
2019-07-22Correctly break out of recovery loopEsteban Küber-2/+3
2019-07-22Handle errors during error recovery gracefullyEsteban Küber-4/+7
2019-07-18Don't drop DiagnosticBuilder if parsing failsJonathan Goodman-1/+1
Beta backport of #62668. If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE.
2019-06-29Always parse 'async unsafe fn' + properly ban in 2015.Mazdak Farrokhzad-8/+18
2019-06-27Rollup merge of #62154 - mark-i-m:old-fixme, r=CentrilMazdak Farrokhzad-1/+1
Remove old fixme fixed in https://github.com/rust-lang/rust/pull/60160 r? @Centril
2019-06-27Rollup merge of #62131 - Xanewok:clip-some-nits, r=petrochenkovMazdak Farrokhzad-9/+9
libsyntax: Fix some Clippy warnings When I was working on it before a lot of these popped up in the RLS so I figured I'll send a small patch fixing only the (hopefully) uncontroversial ones. Others that could be also fixed included also [`clippy::print_with_newline`](https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline) and [`clippy::cast_lossless`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless). Should I add them as well? since most of it touches libsyntax... r? @petrochenkov
2019-06-27Rollup merge of #62124 - matklad:without-with, r=petrochenkovMazdak Farrokhzad-139/+121
refactor lexer to use idiomatic borrowing
2019-06-26remove old fixmeMark Mansi-1/+1
2019-06-26Fix clippy::redundant_field_namesIgor Matuszewski-9/+9
2019-06-25cleanup: rename name_from to symbol_fromAleksey Kladov-20/+19
Lexer uses Symbols for a lot of stuff, not only for identifiers, so the "name" terminology is just confusing.
2019-06-25refactor lexer to use idiomatic borrowingAleksey Kladov-121/+104
2019-06-25Auto merge of #60732 - jswrenn:arbitrary_enum_discriminant, r=pnkfelixbors-36/+43
Implement arbitrary_enum_discriminant Implements RFC rust-lang/rfcs#2363 (tracking issue #60553).
2019-06-24Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkovbors-2/+2
Remove `ast::Guard` With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861, the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here. However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...). r? @petrochenkov
2019-06-23Remove redundant syntax::ast::Guard.Mazdak Farrokhzad-2/+2
2019-06-23let_chains: Fix bugs in pretty printing.Mazdak Farrokhzad-2/+2
2019-06-23let_chains: Refactor parse_{if,while}_expr a bit.Mazdak Farrokhzad-9/+12
2019-06-23let_chains: Move feature gating to pre-expansion.Mazdak Farrokhzad-3/+17
2019-06-23let_chains: Inline visit_expr_with_let_maybe_allowed.Mazdak Farrokhzad-0/+1
2019-06-23let_chains: readd kw::let to ident_can_begin_expr.Mazdak Farrokhzad-2/+1
2019-06-23let_chains: Fix outdated doc-comment re. 'parse_if_expr'.Mazdak Farrokhzad-1/+1
2019-06-23let_chains: Comment out Let in ident_can_begin_expr.Mazdak Farrokhzad-1/+2
2019-06-23let_chains: Add support for parsing let expressions.Mazdak Farrokhzad-49/+19
2019-06-23let_chains: Remove ast::ExprKind::{IfLet, WhileLet} from visitors and ↵Mazdak Farrokhzad-2/+0
introduce ::Let.
2019-06-21Implement arbitrary_enum_discriminantJohn Wrenn-36/+43
2019-06-20Add unit tests for unescaping raw (byte) stringsIgor Matuszewski-0/+30
2019-06-18Remove the HirId/NodeId from where clausesMatthew Jasper-2/+0
Also give them a span in the HIR
2019-06-12Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=petrochenkovbors-10/+22
Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-33/+69
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-12Rollup merge of #61654 - Electron-libre:use_slice_patterns_in_rustc, ↵Mazdak Farrokhzad-37/+27
r=oli-obk,Centril use pattern matching for slices destructuring refs #61542 Use slices pattern where it seems to make sense .
2019-06-10Auto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkovbors-128/+161
lexer: Disallow bare CR in raw byte strings Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings. As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it. @matklad @petrochenkov thoughts?
2019-06-10Don't suggest using \r in raw stringsIgor Matuszewski-1/+7
2019-06-10Special-case literals in `parse_bottom_expr`.Nicholas Nethercote-10/+22
This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it replaces the unnecessary `parse_literal_maybe_minus` call with `parse_lit`, avoiding an unnecessary allocation via `mk_expr`.
2019-06-09Use char byte calculation using existing iteratorIgor Matuszewski-11/+13
2019-06-09Actually translate CRLF in raw byte strings and unify unescape implIgor Matuszewski-25/+69
2019-06-09Add a doc comment for scan_raw_stringIgor Matuszewski-0/+2
2019-06-09Allow attributes in formal function parametersCaio-33/+69
2019-06-09Translate CRLF -> LF in raw (byte) stringsIgor Matuszewski-34/+18
2019-06-08Prohibit bare CRs in raw byte stringsIgor Matuszewski-70/+53
2019-06-08Validate and transcribe raw strings via unescape moduleIgor Matuszewski-46/+59
2019-06-08syntax: Move some `Token` methods aroundVadim Petrochenkov-48/+40
2019-06-08syntax: Remove `Deref` impl from `Token`Vadim Petrochenkov-31/+24
2019-06-08syntax: Move most of the `TokenKind` methods to `Token`Vadim Petrochenkov-81/+49
2019-06-08fix libsyntax testCedric-4/+4
2019-06-08Remove redundant, commented out codeIgor Matuszewski-6/+0
It was commented out as part of https://github.com/rust-lang/rust/commit/8a8e497ae786ffc032c1e68fc23da0edcf6fa5e3. Done probably by accident, since the code in question was moved to a match arm, along with newly introduced logic to detect bare CRs in raw strings.
2019-06-08Separate a `scan_raw_string` (similar `raw_byte` variant)Igor Matuszewski-77/+82