about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2017-10-15don't issue "expected statement after outer attr." after inner attr.Zack M. Davis-2/+2
While an inner attribute here is in fact erroneous, that error ("inner attribute is not permitted in this context") successfully gets set earlier; this further admonition is nonsensical. Resolves #45296.
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-26/+40
2017-10-13Rollup merge of #45178 - Badel2:comma-after-struct, r=petrochenkovkennytm-0/+11
Better error message for comma after base struct #41834 This adds a better error for commas after the base struct: ``` let foo = Foo { one: 111, ..Foo::default(), // This comma is a syntax error }; ``` The current error is a generic `expected one of ...` which isn't beginner-friendly. My error looks like this: ``` error: cannot use a comma after the base struct --> tmp/example.rs:26:9 | 26 | ..Foo::default(), | ^^^^^^^^^^^^^^^^- help: remove this comma | = note: the base struct expansion must always be the last field ``` I even added a note for people who don't know why this isn't allowed.
2017-10-13Rollup merge of #45122 - jean-lourenco:master, r=nikomatsakiskennytm-0/+1
Better compile error output when using arguments instead of types Following @estebank sugestion on issue https://github.com/rust-lang/rust/issues/18945#issuecomment-331251436
2017-10-10output compiler message updatedJean Lourenço-0/+1
output message is shown in another 'help:' block line with +100 columns formatted test adjusted
2017-10-11Add error for comma after base struct fieldBadel2-0/+11
`let x = { ..default(), } // This comma is an error`
2017-10-09Fix a bug in diagnostics for `x as usize < y`Vadim Petrochenkov-3/+16
Improve diagnostics for `x as usize << y`
2017-10-06Add a semicolon to span for ast::LocalSeiichi Uchida-1/+6
2017-10-03Rename FileMap::path and change to an OptionPhilip Craig-1/+1
2017-09-30Don't use remapped path when loading modules and include filesPhilip Craig-1/+1
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