about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2019-01-14Rollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkovMazdak Farrokhzad-24/+35
Recover from item trailing semicolon CC https://github.com/rust-lang/rfcs/pull/2479 r? @petrochenkov
2019-01-14Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkovMazdak Farrokhzad-10/+3
Unaccept `extern_in_paths` Based on completed fcp-close in https://github.com/rust-lang/rust/issues/55600, this removes `extern_in_path` (e.g. `extern::foo::bar`) from the language. The changes are primarily reversing https://github.com/rust-lang/rust/commit/32db83b16e06cb5cca72d0e6a648a8008eda0fac. Closes https://github.com/rust-lang/rust/issues/55600 r? @petrochenkov
2019-01-14Rollup merge of #57540 - estebank:eval-more, r=petrochenkovMazdak Farrokhzad-29/+114
Modify some parser diagnostics to continue evaluating beyond the parser Continue evaluating further errors after parser errors on: - trailing type argument attribute - lifetime in incorrect location - incorrect binary literal - missing `for` in `impl Trait for Foo` - type argument in `where` clause - incorrect float literal - incorrect `..` in pattern - associated types - incorrect discriminator value variant error and others. All of these were found by making `continue-parse-after-error` `true` by default to identify errors that would need few changes. There are now only a handful of errors that have any change with `continue-parse-after-error` enabled. These changes make it so `rust` _won't_ stop evaluation after finishing parsing, enabling type checking errors to be displayed on the existing code without having to fix the parse errors. Each commit has an individual diagnostic change with their corresponding tests. CC #48724.
2019-01-13Recover from item trailing semicolonEsteban Küber-24/+35
2019-01-13Rollup merge of #57004 - nnethercote:TS-change-Stream, r=petrochenkovMazdak Farrokhzad-1/+1
Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-13remove extern_in_paths.Mazdak Farrokhzad-10/+3
2019-01-12Suggest correct location for lifetime parameters in useEsteban Küber-9/+43
2019-01-11Tweak incorrect discriminator value variant errorEsteban Küber-7/+13
2019-01-11Small tweaks to parser errorsEsteban Küber-7/+20
2019-01-11Tweak type argument after assoc type errorEsteban Küber-2/+9
2019-01-11Continue evaluating after finding incorrect .. in patternEsteban Küber-3/+10
2019-01-11Continue evaluating after type argument in where clauseEsteban Küber-2/+6
2019-01-11Continue evaluating after missing `for` in `impl Trait for Foo`Esteban Küber-1/+7
2019-01-11Continue parsing after lifetime in incorrect locationEsteban Küber-2/+6
2019-01-11Continue parser after trailing type argument attributeEsteban Küber-2/+6
2019-01-11stabilize top level or-pats in if/while let.Mazdak Farrokhzad-2/+3
2019-01-08Make `TokenStream` less recursive.Nicholas Nethercote-1/+1
`TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
2019-01-02Auto merge of #57251 - petrochenkov:reregr, r=varkorbors-1/+2
syntax: Fix regression in diagnostics for patterns in trait method parameters Fixes https://github.com/rust-lang/rust/issues/55036
2019-01-01syntax: Fix regression in diagnostics for patterns in trait method parametersVadim Petrochenkov-1/+2
2018-12-31Address review commentsEsteban Küber-12/+13
- Suggest raw ident escaping in all editions - Keep primary label in all cases
2018-12-31Suggest using raw identifiers in 2018 edition when using keywordsEsteban Küber-1/+12
2018-12-27Address review comments and CI failuresVadim Petrochenkov-0/+1
2018-12-27Fix `trace_macros` and `log_syntax`Vadim Petrochenkov-1/+1
2018-12-27Get rid of `Block::recovered`Vadim Petrochenkov-6/+6
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-19Rollup merge of #56820 - ljedrz:format_tweaks, r=alexcrichtonPietro Albini-0/+3
format-related tweaks - remove an unreachable condition - inline one-liners related to `parse_expr` (called in succession) - refactor `report_invalid_references` - refactor `verify_arg_type` - minor stylistic improvements
2018-12-17Auto merge of #56737 - nnethercote:TokenStream-improvements, r=petrochenkovbors-2/+2
`TokenStream` improvements Some `TokenStream` improvements: shrinking `TokenStream` and some other types, and some other code clean-ups.
2018-12-15Auto merge of #56584 - davidtwco:issue-53990, r=nikomatsakisbors-4/+15
2018 edition - confusing error message when declaring unnamed parameters Fixes #53990. This PR adds a note providing context for the change to argument names being required in the 2018 edition for trait methods and a suggestion for the fix.
2018-12-14format: inline one-liners related to parse_exprljedrz-0/+3
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-2/+2
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-38/+42
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-08Rollup merge of #56248 - estebank:suggest-bare-pub, r=petrochenkovMazdak Farrokhzad-20/+48
Suggest an appropriate token when encountering `pub Ident<'a>` Fix #55403. Follow up to #45997.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-12/+12
2018-12-07Add suggestion for underscore binding fix.David Wood-0/+9
This commit emits a suggestion for adding an underscore binding to arguments in trait methods that previously did not have a argument name specified.
2018-12-07Add context for RFC 1685 change in 2018 edition.David Wood-4/+6
This commit adds a note providing context for the change to argument names being required in the 2018 edition for trait methods.
2018-12-06Auto merge of #56392 - petrochenkov:regensym, r=oli-obkbors-14/+13
Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution So they cannot be cloned by macros. See https://github.com/rust-lang/rust/pull/56303 for the discussion. Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in https://github.com/rust-lang/rust/pull/56303#issuecomment-442464695. Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in https://github.com/rust-lang/rust/pull/56303#issuecomment-442274118). Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc https://github.com/rust-lang/rust/pull/55983). Add more tests for `use foo as _` imports.
2018-12-04Address review commentsVadim Petrochenkov-2/+2
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-3/+3
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-12-03Rollup merge of #56433 - yui-knk:update_comment_of_parse_visibility, ↵kennytm-3/+4
r=petrochenkov Add description about `crate` for parse_visibility's comment This rule was introduced by https://github.com/rust-lang/rust/pull/45401.
2018-12-03Rollup merge of #56419 - mark-i-m:remove-try, r=Centrilkennytm-4/+2
Remove some uses of try!
2018-12-02Delay gensym creation for "underscore items" until name resolutionVadim Petrochenkov-14/+13
Prohibit `static _` Fis unused import warnings for `use foo as _` Add more tests for `use foo as _`
2018-12-02Fix "line longer than 100 chars"yui-knk-3/+4
2018-12-02Add description about `crate` for parse_visibility's commentyui-knk-1/+1
This rule was introduced by https://github.com/rust-lang/rust/pull/45401.
2018-12-01remove some uses of try!Mark Mansi-4/+2
2018-12-01resolve: Support aliasing local crate root in extern preludeVadim Petrochenkov-1/+5
2018-11-30Use appropriate terminology based on heuristicEsteban Küber-13/+24
2018-11-30Suggest an appropriate token when encountering `pub Ident<'a>`Esteban Küber-11/+28
2018-12-01Rollup merge of #56336 - nnethercote:clean-up-pp, r=nikomatsakiskennytm-1/+1
Clean up and streamline the pretty-printer Some minor improvements.
2018-11-29Rollup merge of #56330 - estebank:cleanup-span, r=zackmdavisGuillaume Gomez-2/+2
Clean up span in non-trailing `..` suggestion
2018-11-29Rollup merge of #56220 - estebank:suggest-lifetime-move, r=nikomatsakisGuillaume Gomez-8/+45
Suggest appropriate place for lifetime when declared after type arguments