about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
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-21/+36
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-18Fix up tests and typosSeiichi Uchida-2/+2
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-1/+1
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-23/+29
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-04Rollup merge of #47947 - goodmanjonathan:stabilize_match_beginning_vert, ↵kennytm-6/+1
r=petrochenkov Stabilize feature(match_beginning_vert) With this feature stabilized, match expressions can optionally have a `|` at the beginning of each arm. Reference PR: rust-lang-nursery/reference#231 Closes #44101
2018-02-03Auto merge of #47845 - Zoxc:gen-fixes, r=nikomatsakisbors-0/+1
Generator bugfixes r? @nikomatsakis
2018-02-01Fix test after rebaseEsteban Küber-5/+1
2018-02-01Remove support for `Self` in attributesEsteban Küber-7/+1
2018-02-01Fix testsEsteban Küber-1/+1
2018-02-01Rework `parse_ident_attr`Esteban Küber-25/+26
2018-02-01Add filtering options to `rustc_on_unimplemented`Esteban Küber-6/+12
- filter error on the evaluated value of `Self` - filter error on the evaluated value of the type arguments - add argument to include custom note in diagnostic - allow the parser to parse `Self` when processing attributes - add custom message to binops
2018-02-01Improve char escaping in lexer messagesRyan Cumming-12/+19
Currently ', " and \ are escaped as \', \" and \\ respectively. This leads to confusing messages such as `error: unknown start of token: \\` when encountering a single backslash. Fix by emitting printable ASCII characters directly. This will still escape \r, \n, \t and Unicode characters. Fixes #47902
2018-01-31Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakisbors-0/+1
Highlight code on diagnostics when underlined Highlight the label's span with the respective color: <img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png"> Fix #42112.
2018-01-30stabilize match_beginning_vertJonathan Goodman-6/+1
2018-01-30The `static` keyword can now begin expressionsJohn Kåre Alsaker-0/+1
2018-01-30Auto merge of #45294 - petrochenkov:prioplus, r=nikomatsakisbors-10/+25
syntax: Lower priority of `+` in `impl Trait`/`dyn Trait` Now you have to write `Fn() -> (impl A + B)` instead of `Fn() -> impl A + B`, this is consistent with priority of `+` in trait objects (`Fn() -> A + B` means `(Fn() -> A) + B`). To make this viable I changed the syntax to also permit `+` in return types in function declarations ``` fn f() -> dyn A + B { ... } // OK, don't have to write `-> (dyn A + B)` // This is acceptable, because `dyn A + B` here is an isolated type and // not part of a larger type with various operator priorities in play // like `dyn A + B` in `Fn() -> dyn A + B` despite syntax similarities. ``` but you still have to use `-> (dyn A + B)` in function types and function-like trait object types (see this PR's tests for examples). This can be a breaking change for code using `impl Trait` on nightly. The thing that is most likely to break is `&impl A + B`, it needs to be rewritten as `&(impl A + B)`. cc https://github.com/rust-lang/rust/issues/34511 https://github.com/rust-lang/rust/issues/44662 https://github.com/rust-lang/rfcs/pull/438
2018-01-29Toggle span highlighting on `-Zteach`Esteban Küber-0/+1
2018-01-28Auto merge of #47767 - estebank:as-suggestion, r=petrochenkovbors-0/+1
Correctly format `extern crate` conflict resolution help Closes #45799. Follow up to @Cldfire's #45820. If the `extern` statement that will have a suggestion ends on a `;`, synthesize a new span that doesn't include it.
2018-01-27Make `+` in `impl/dyn Trait` non-associativeVadim Petrochenkov-3/+19
2018-01-27syntax: Permit `+` in return types of function declarationsVadim Petrochenkov-6/+6
`+` is still disallowed in function types and function-like traits
2018-01-27syntax: Lower priority of `+` in `impl Trait`/`dyn Trait`Vadim Petrochenkov-4/+3
2018-01-27end_point handling multibyte characters correctly.David Wood-3/+5
2018-01-26Instead of modifying the item's span synthesize itEsteban Küber-2/+1
2018-01-26Merge branch 'no-stderr-sink' of https://github.com/Zoxc/rust into rollupAlex Crichton-37/+36
2018-01-25Correctly format `extern crate` conflict resolution helpCldfire-1/+3
2018-01-26Do not capture stderr in the compiler. Instead just panic silently for fatal ↵John Kåre Alsaker-37/+36
errors
2018-01-25Rollup merge of #47502 - petrochenkov:label, r=eddybAlex Crichton-41/+23
AST/HIR: Add a separate structure for labels
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-10/+35
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-22AST/HIR: Add a separate structure for labelsVadim Petrochenkov-41/+23
2018-01-15Point at unused arguments for format stringEsteban Küber-10/+15
Avoid overlapping spans by only pointing at the arguments that are not being used in the argument string. Enable libsyntax to have diagnostics with multiple primary spans by accepting `Into<MultiSpan>` instead of `Span`.
2018-01-14syntax: Disambiguate generics and qualified pathsVadim Petrochenkov-15/+33