about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2018-03-23Merge branch 'master' of https://github.com/Lymia/rust into rollupAlex Crichton-70/+144
2018-03-22Clean up raw identifier handling when recovering tokens from AST.Lymia Aluysia-1/+1
2018-03-22Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebankkennytm-2/+0
address some FIXME whose associated issues were marked as closed part of #44366
2018-03-20Auto merge of #49190 - kennytm:rollup, r=kennytmbors-10/+1
Rollup of 17 pull requests - Successful merges: #46518, #48810, #48834, #48902, #49004, #49092, #49096, #49099, #49104, #49125, #49139, #49152, #49157, #49161, #49166, #49176, #49184 - Failed merges:
2018-03-20Stabilize slice patterns without `..`Vadim Petrochenkov-1/+1
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-20Rollup merge of #49104 - csmoe:semicolon_error, r=petrochenkovkennytm-10/+1
improve error message of inner attribute syntax Fixes #49040
2018-03-18Return a is_raw parameter from Token::ident rather than having separate methods.Lymia Aluysia-30/+15
2018-03-18Move raw_identifiers check to the lexer.Lymia Aluysia-4/+5
2018-03-18Feature gate raw identifiers.Lymia Aluysia-1/+9
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-73/+153
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-82/+39
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-54/+23
Fix spans of root segments
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-2/+2
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-10/+6
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-35/+24
2018-03-17remove FIXME(#8372) since for-loops wont support borrowing iteratorsNiv Kaminer-2/+0
2018-03-17improve attribute trailing semicolon errorcsmoe-10/+1
2018-03-17Auto merge of #48904 - Zoxc:code-and-file-maps, r=michaelwoeristerbors-1/+1
Make CodeMap and FileMap thread-safe r? @michaelwoerister
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-16Rollup merge of #48922 - petrochenkov:asunder, r=nikomatsakiskennytm-1/+5
Implement import renaming with `_` (RFC 2166) cc https://github.com/rust-lang/rust/issues/48216
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-15Use a single Lock for CodeMap.stable_id_to_filemap and CodeMap.filesJohn Kåre Alsaker-1/+1
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-403/+465
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-08Rollup merge of #48527 - zackmdavis:and_the_social_construction_of_tuples, ↵Manish Goregaokar-5/+39
r=estebank in which parentheses are suggested for should-have-been-tuple-patterns ![destructure_suggest_parens](https://user-images.githubusercontent.com/1076988/36638335-48b082d4-19a7-11e8-9726-0d043544df2f.png) 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, 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 a "top-level" pattern, rather than within `parse_pat` itself, because `parse_pat` gets called recursively to parse the sub-patterns within a tuple pattern. ~~We could also do this for `match` arms, `if let`, and `while let`, but we elect not to in this patch, as it seems less likely for users to make the mistake in those contexts.~~ Resolves #48492. r? @petrochenkov
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-08Move REGISTERED_DIAGNOSTICS to a ParseSess fieldJohn Kåre Alsaker-1/+8
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 #48546 - GuillaumeGomez:raw-string-error-note, r=estebankkennytm-8/+25
Raw string error note Fixes #48395. I think this note should be helpful enough to solve the issue.
2018-03-06Rollup merge of #48403 - lukaslueg:casted, r=steveklabnikkennytm-1/+1
Fix spelling s/casted/cast/ r? @GuillaumeGomez
2018-03-04Add note for unterminated raw string errorGuillaume Gomez-8/+25
2018-03-02Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkovManish Goregaokar-31/+121
Fixes #47311. r? @nrc
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-35/+33
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