about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2017-09-27Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkovbors-17/+40
Initial support for `..=` syntax #28237 This PR adds `..=` as a synonym for `...` in patterns and expressions. Since `...` in expressions was never stable, we now issue a warning. cc @durka r? @aturon
2017-09-22Add information about the syntax used in rangesBadel2-4/+7
... or ..=
2017-09-22Add support for `..=` syntaxAlex Burka-15/+35
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-22Include unary operator to span for ExprKind::UnarySeiichi Uchida-7/+7
2017-09-17Remove rustc_bitflags; use the bitflags crateTamir Duberstein-23/+23
2017-09-14Auto merge of #44484 - tirr-c:issue-44332, r=petrochenkovbors-6/+38
Parse nested closure with two consecutive parameter lists properly This is a followup of #44332. --- Currently, in nightly, this does not compile: ```rust fn main() { let f = |_||x, y| x+y; println!("{}", f(())(1, 2)); // should print 3 } ``` `|_||x, y| x+y` should be parsed as `|_| (|x, y| x+y)`, but the parser didn't accept `||` between `_` and `x`. This patch fixes the problem. r? @petrochenkov
2017-09-11Auto merge of #44375 - topecongiro:macrodef-span, r=petrochenkovbors-5/+5
Add visibility to span for macros 2.0 cc https://github.com/rust-lang-nursery/rustfmt/issues/1949. r? @nrc
2017-09-11Parse nested closure with two consecutive parameter lists properlyWonwoo Choi-6/+38
2017-09-07Add visibility to span for macros 2.0topecongiro-5/+5
2017-09-05Expect pipe symbol after closure parameter listsWonwoo Choi-1/+1
2017-09-01Implement RFC 1925Matt Ickstadt-0/+7
2017-08-31Auto merge of #43425 - matklad:lambda-restrictions, r=eddybbors-1/+4
Lambda expressions honor no struct literal restriction This is a fix for #43412 if we decide that it is indeed a bug :) closes #43412
2017-08-30Make fields of `Span` privateVadim Petrochenkov-22/+17
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+19
2017-08-22Ensure that generic arguments don't end up in attribute paths.Jeffrey Seyfried-1/+7
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-21/+18
2017-08-22Auto merge of #43854 - estebank:missing-cond, r=nikomatsakisbors-0/+12
Point out missing if conditional On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ``` Fix #13483.
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-21/+18
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-17Verify that an `if` condition block returns a valueEsteban Küber-1/+6
2017-08-17Check for `else` keyword on missing `if` conditionEsteban Küber-16/+11
2017-08-17Point out missing if conditionalEsteban Küber-4/+16
On a case where an else conditional is missing, point this out instead of the token immediately after the (incorrect) else block: ``` error: missing condition for `if` statemementt push fork -f --> $DIR/issue-13483.rs:16:5 | 13 | } else if { | ^ expected if condition here ``` instead of ``` error: expected `{`, found `else` --> ../../src/test/ui/issue-13483.rs:14:7 | 14 | } else { | ^^^^ ```
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-84/+84
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-84/+84
Like #43008 (f668999), but _much more aggressive_.
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+1
2017-08-12Include 'let' keyword to the span for ast::Localtopecongiro-1/+1
2017-08-11Issue warnings for unnecessary path disambiguatorsVadim Petrochenkov-10/+18
2017-08-11syntax: Relax path grammarVadim Petrochenkov-13/+2
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-10/+13
2017-08-10Reword error hintKornel-1/+2
2017-08-10Better diagnostics and recovery for `const` in extern blocksVadim Petrochenkov-12/+12
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-9/+133
2017-08-07Hint correct extern constant syntaxKornel-1/+3
2017-07-30Auto merge of #43551 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-0/+4
Rollup of 8 pull requests - Successful merges: #43409, #43501, #43509, #43512, #43513, #43536, #43544, #43549 - Failed merges:
2017-07-29Rollup merge of #43501 - topecongiro:span-to-whereclause, r=nrcMark Simulacrum-0/+4
Add Span to ast::WhereClause This PR adds `Span` field to `ast::WhereClause`. The motivation here is to make rustfmt's life easier when recovering comments before and after where clause. r? @nrc
2017-07-29Auto merge of #43009 - GuillaumeGomez:unused-doc-comments, r=nrcbors-5/+4
Throw errors when doc comments are added where they're unused #42617
2017-07-28syntax: Capture a `TokenStream` when parsing itemsAlex Crichton-5/+125
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.
2017-07-29Add Span to ast::WhereClausetopecongiro-0/+4
2017-07-28syntax: Add `tokens: Option<TokenStream>` to ItemAlex Crichton-0/+1
This commit adds a new field to the `Item` AST node in libsyntax to optionally contain the original token stream that the item itself was parsed from. This is currently `None` everywhere but is intended for use later with procedural macros.
2017-07-28Remove support for `gen arg`Alex Crichton-13/+1
2017-07-28Fix tidy warningsAlex Crichton-1/+1
2017-07-28Generator literal supportJohn Kåre Alsaker-1/+21
2017-07-27Give span to angle bracketed generic argumentsVadim Petrochenkov-3/+3
2017-07-27Simplify parsing of pathsVadim Petrochenkov-249/+124
2017-07-27Make a lint insteadGuillaume Gomez-32/+0
2017-07-27Throw errors when doc comments are added where they're unusedGuillaume Gomez-5/+36
2017-07-27Auto merge of #43489 - petrochenkov:mutref, r=GuillaumeGomezbors-2/+12
Better diagnostics and recovery for `mut ref` in patterns Fixes https://github.com/rust-lang/rust/issues/43286 Supersedes https://github.com/rust-lang/rust/pull/43451 r? @GuillaumeGomez
2017-07-26Better diagnostics and recovery for `mut ref` in patternsVadim Petrochenkov-2/+12
2017-07-25Fix the spans of catch blocks to include the `do`Nick Cameron-1/+1
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-1/+16
Point at `:` when using it instead of `;` When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription. Fix #42057, #41928.
2017-07-23Auto merge of #43386 - oli-obk:suggestions, r=nikomatsakisbors-1/+1
Adjust new suggestions to the suggestion guidelines Addresses https://github.com/rust-lang/rust/pull/42033#discussion_r127694915 guidelines are https://github.com/rust-lang/rust/blob/master//src/librustc_errors/diagnostic.rs#L212-L224