about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2018-03-23Merge branch 'master' of https://github.com/Lymia/rust into rollupAlex Crichton-12/+17
2018-03-20Stabilize slice patterns without `..`Vadim Petrochenkov-1/+1
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-18Move raw_identifiers check to the lexer.Lymia Aluysia-4/+1
2018-03-18Feature gate raw identifiers.Lymia Aluysia-1/+4
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-12/+17
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-80/+36
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17Cleanup import parsingVadim Petrochenkov-53/+22
Fix spans of root segments
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-1/+1
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-10/+5
Add the root segment for name resolution purposes only
2018-03-17AST: Make renames in imports closer to the sourceVadim Petrochenkov-3/+1
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17AST/HIR: Clarify what the optional name in extern crate items meanVadim Petrochenkov-13/+7
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-20/+16
2018-03-16Auto merge of #49051 - kennytm:rollup, r=kennytmbors-1/+5
Rollup of 17 pull requests - Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972 - Failed merges:
2018-03-15Disallow &a..=b and box a..=b in pattern.kennytm-2/+27
They are disallowed because they have different precedence than expressions. I assume parenthesis in pattern will be soon stabilized and thus write that as suggestion directly.
2018-03-14Implement import renaming with `_` (RFC 2166)Vadim Petrochenkov-1/+5
2018-03-11in which some labels and notes are upgraded to structured suggestionsZack M. Davis-5/+8
(Meanwhile, a couple of parse-fail tests are moved to UI tests so that the reader can see the new output, and an existing UI test is given a more evocative name.)
2018-03-09Auto merge of #48326 - RalfJung:generic-bounds, r=petrochenkovbors-12/+3
Warn about ignored generic bounds in `for` This adds a new lint to fix #42181. For consistency and to avoid code duplication, I also moved the existing "bounds in type aliases are ignored" here. Questions to the reviewer: * Is it okay to just remove a diagnostic error code like this? Should I instead keep the warning about type aliases where it is? The old code provided a detailed explanation of what's going on when asked, that information is now lost. On the other hand, `span_warn!` seems deprecated (after this patch, it has exactly one user left!). * Did I miss any syntactic construct that can appear as `for` in the surface syntax? I covered function types (`for<'a> fn(...)`), generic traits (`for <'a> Fn(...)`, can appear both as bounds as as trait objects) and bounds (`for<'a> F: ...`). * For the sake of backwards compatibility, this adds a warning, not an error. @nikomatsakis suggested an error in https://github.com/rust-lang/rust/issues/42181#issuecomment-306924389, but I feel that can only happen in a new epoch -- right? Cc @eddyb
2018-03-08in which parentheses are suggested for should-have-been-tuple-patternsZack M. Davis-5/+39
Programmers used to working in some other languages (such as Python or Go) might expect to be able to destructure values with comma-separated identifiers but no parentheses on the left side of an assignment. Previously, the first name in such code would get parsed as a single-indentifier pattern—recognizing, for example, the `let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax error on seeing an unexpected comma rather than the expected semicolon (all the way nearer to the end of `parse_full_stmt`). Instead, let's look for that comma when parsing the pattern, and if we see it, momentarily make-believe that we're parsing the remaining elements in a tuple pattern, so that we can suggest wrapping it all in parentheses. We need to do this in a separate wrapper method called on the top-level pattern (or `|`-patterns) in a `let` statement, `for` loop, `if`- or `while let` expression, or match arm rather than within `parse_pat` itself, because `parse_pat` gets called recursively to parse the sub-patterns within a tuple pattern. Resolves #48492.
2018-03-06note a FIXMERalf Jung-0/+1
2018-03-06make bounds on higher-kinded lifetimes a hard error in ast_validationRalf Jung-12/+2
Also move the check for not having type parameters into ast_validation. I was not sure what to do with compile-fail/issue-23046.rs: The issue looks like maybe the bounds actually played a role in triggering the ICE, but that seems unlikely given that the compiler seems to entirely ignore them. However, I couldn't find a testcase without the bounds, so I figured the best I could do is to just remove the bounds and make sure at least that keeps working.
2018-03-06Rollup merge of #48403 - lukaslueg:casted, r=steveklabnikkennytm-1/+1
Fix spelling s/casted/cast/ r? @GuillaumeGomez
2018-03-02Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkovManish Goregaokar-31/+121
Fixes #47311. r? @nrc
2018-03-01Fix spelling s/casted/cast/Lukas Lueg-1/+1
2018-03-01Support parentheses in patterns under feature gateVadim Petrochenkov-26/+40
Improve recovery for trailing comma after `..`
2018-02-27Diagnostic tweaks (review)Esteban Küber-17/+11
2018-02-27Add label to primary span in some parse errorsEsteban Küber-21/+64
2018-02-27Detect missing `if` blocksEsteban Küber-8/+27
When unnecessarily using a fat arrow after an if condition, suggest the removal of it. When finding an if statement with no block, point at the `if` keyword to provide more context.
2018-02-27Provide missing comma in match arm suggestionEsteban Küber-2/+36
When finding: ```rust match &Some(3) { &None => 1 &Some(2) => { 3 } _ => 2 } ``` provide the following diagnostic: ``` error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>` --> $DIR/missing-comma-in-match.rs:15:18 | X | &None => 1 | -- - help: missing comma | | | while parsing the match arm starting here X | &Some(2) => { 3 } | ^^ expected one of `,`, `.`, `?`, `}`, or an operator here ```
2018-02-26Auto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkovbors-1/+1
macros: improve struct constructor field hygiene, fix span bug Fixes #47311. r? @nrc
2018-02-24Rollup merge of #48490 - petrochenkov:orpat, r=eddybManish Goregaokar-4/+4
Implement multiple patterns with `|` in `if let` and `while let` (RFC 2175) cc https://github.com/rust-lang/rust/issues/48215
2018-02-24Rollup merge of #48481 - Manishearth:dyn-paren, r=petrochenkovManish Goregaokar-5/+9
Allow parentheses in `dyn (Trait)` r? @eddyb @nikomatsakis
2018-02-24Rollup merge of #48441 - petrochenkov:exty, r=estebankManish Goregaokar-1/+1
Fix parsing of extern paths in types and poly-traits Fixes https://github.com/rust-lang/rust/issues/48262
2018-02-24Rollup merge of #48356 - estebank:unsafe-without-braces, r=nikomatsakisManish Goregaokar-0/+2
When encountering invalid token after `unsafe`, mention `{` Fix #37158.
2018-02-24Implement multiple patterns with `|` in `if let` and `while let`Vadim Petrochenkov-4/+4
2018-02-23parse `dyn (Foo)` as a trait objectManish Goregaokar-5/+9
2018-02-23Rollup merge of #48083 - ↵Manish Goregaokar-5/+3
jseyfried:improve_tuple_struct_field_access_hygiene, r=petrochenkov Improve tuple struct field access hygiene Fixes #47312 by fixing a span bug. r? @nrc
2018-02-23Auto merge of #47799 - topecongiro:fix-span-of-visibility, r=petrochenkovbors-19/+34
Fix span of visibility This PR 1. adds a closing parenthesis to the span of `Visibility::Crate` (e.g. `pub(crate)`). The current span only covers `pub(crate`. 2. adds a `span` field to `Visibility::Restricted`. This span covers the entire visibility expression (e.g. `pub (in self)`). Currently all we can have is a span for `Path`. This PR is motivated by the bug found in rustfmt (https://github.com/rust-lang-nursery/rustfmt/issues/2398). The first change is a strict improvement IMHO. The second change may not be desirable, as it adds a field which is currently not used by the compiler.
2018-02-23Fix parsing of extern paths in types and poly-traitsVadim Petrochenkov-1/+1
2018-02-19When encountering invalid token after `unsafe`, mention `{`Esteban Küber-0/+2
2018-02-17Fix span bug.Jeffrey Seyfried-1/+1
2018-02-17fix more typos found by codespell.Matthias Krüger-2/+2
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-22/+28
2018-02-18Add a span field to Visibility::RestrictedSeiichi Uchida-2/+10
This span covers the whole visibility expression: e.g. `pub (in path)`.
2018-02-18Add a closing parenthesis to the span of Visibility::CrateSeiichi Uchida-2/+3
2018-02-11Continue parsing function after finding `...` argEsteban Küber-5/+16
When encountering a variadic argument in a function definition that doesn't accept it, if immediately after there's a closing paren, continue parsing as normal. Otherwise keep current behavior of emitting error and stopping.
2018-02-08Fix span bug.Jeffrey Seyfried-5/+3
2018-02-07Rollup merge of #47613 - estebank:rustc_on_unimplemented, r=nikomatsakisManish Goregaokar-17/+14
Add filtering options to `rustc_on_unimplemented` - Add filtering options to `rustc_on_unimplemented` for local traits, filtering on `Self` and type arguments. - Add a way to provide custom notes. - Tweak binops text. - Add filter to detect wether `Self` is local or belongs to another crate. - Add filter to `Iterator` diagnostic for `&str`. Partly addresses #44755 with a different syntax, as a first approach. Fixes #46216, fixes #37522, CC #34297, #46806.
2018-02-01Fix test after rebaseEsteban Küber-4/+0
2018-02-01Remove support for `Self` in attributesEsteban Küber-7/+1
2018-02-01Fix testsEsteban Küber-1/+1