about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
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
2019-06-08Clean up minor bitsIgor Matuszewski-2/+2
2019-06-08cast vec to slicesCedric-5/+5
2019-06-08use default binding mode in match clausesCedric-5/+5
2019-06-08fix bad style for structsCedric-8/+8
2019-06-08improve styleCedric-13/+10
2019-06-08use pattern matching for slices destructuringCedric-31/+24
2019-06-08Rollup merge of #61616 - petrochenkov:parsderef, r=oli-obkMazdak Farrokhzad-248/+238
parser: Remove `Deref` impl from `Parser` Follow up to https://github.com/rust-lang/rust/pull/61541 You have to write `self.token.span` instead of `self.span` in the parser now, which is not nice, but not too bad either, I guess. Not sure. Probably still better than people using both and being confused about the definition point of `span`. r? @oli-obk @estebank
2019-06-07syntax: Treat error literals in more principled wayVadim Petrochenkov-1/+5
2019-06-07parser: Remove `look_ahead_span`Vadim Petrochenkov-18/+5
2019-06-07parser: Remove `Deref` impl from `Parser`Vadim Petrochenkov-10/+0
2019-06-07parser: `self.span` -> `self.token.span`Vadim Petrochenkov-224/+237
2019-06-06Address review commentsVadim Petrochenkov-4/+8
2019-06-06Some code cleanup and tidy/test fixesVadim Petrochenkov-41/+54
2019-06-06syntax: Switch function parameter order in `TokenTree::token`Vadim Petrochenkov-20/+20
2019-06-06syntax: Use `Token` in some more placesVadim Petrochenkov-4/+4
2019-06-06syntax: Remove duplicate span from `token::Ident`Vadim Petrochenkov-104/+105
2019-06-06syntax: Remove duplicate span from `token::Lifetime`Vadim Petrochenkov-30/+34
2019-06-06syntax: Add some helper methods to `Token`Vadim Petrochenkov-51/+54
2019-06-06syntax: Use `Token` in `Parser`Vadim Petrochenkov-106/+107
2019-06-06syntax: Use `Token` in `StringReader` and `TokenTreesReader`Vadim Petrochenkov-46/+32
2019-06-06syntax: Use `Token` in `TokenTree::Token`Vadim Petrochenkov-56/+62
2019-06-06syntax: Rename `TokenAndSpan` into `Token`Vadim Petrochenkov-94/+91
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-66/+66
2019-06-06Always use token kinds through `token` module rather than `Token` typeVadim Petrochenkov-12/+12
2019-06-05Implemented for function bounds, type bounds, and named existential types.Alexander Regueiro-21/+31
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-29/+29
2019-06-05Auto merge of #61484 - nnethercote:avoid-more-hygiene-lookups, r=petrochenkovbors-8/+11
Avoid more hygiene lookups Mostly by combining multiple `HygieneData::with` calls into a single call on hot paths. r? @petrochenkov
2019-06-05Avoid unnecessary `rust_2018` calls.Nicholas Nethercote-8/+11
The commit combines two calls into one by saving the result in a local variable. The commit also moves the check for `async` later, so that when a different keyword is present the `rust_2018` call will be avoided completely.
2019-06-04Rollup merge of #61500 - estebank:expregression, r=petrochenkovPietro Albini-7/+11
Fix regression 61475 Addresses #61475.
2019-06-04Rollup merge of #61413 - davidtwco:async-argument-order-in-a-sane-way, r=eddybMazdak Farrokhzad-130/+13
Re-implement async fn drop order lowering This PR re-implements the async fn drop order lowering changes so that it all takes place in HIR lowering, building atop the work done by @eddyb to refactor `Res::Upvar`. Previously, this types involved in the lowering were constructed in libsyntax as they had to be used during name resolution and HIR lowering. This was awful because none of that logic should have existed in libsyntax. This commit also changes `ArgSource` to keep a `HirId` to the original argument pattern rather than a cloned copy of the pattern. Only b7aa4ed and 71fb8fa should be reviewed, any other commits are from #61276 (though 447e336 might end up staying in this PR). As a nice side effect, it also fixes #61187 (cc #61192). r? @eddyb cc @cramertj