about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
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
2017-07-23Lambda expressions honor no struct literal restrictionAleksey Kladov-1/+4
2017-07-21Adjust new suggestions to the suggestion guidelinesOliver Schneider-1/+1
2017-07-20Use the macro structure spans instead of the invocationEsteban Küber-5/+3
2017-07-18Unify rules about commas in match arms and semicolons in expressionsAleksey Kladov-2/+1
2017-07-17Add flag to hide code on inline suggestionsEsteban Küber-3/+3
Now there's a way to add suggestions that hide the suggested code when presented inline, to avoid weird wording when short code snippets are added at the end.
2017-07-17Change some helps to suggestionsOliver Schneider-2/+2
2017-07-16Point at `:` when using it instead of `;`Esteban Küber-1/+16
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.
2017-07-11Refactor methods onto Printer struct.Mark Simulacrum-6/+4
No (intentional) changes to behavior. This is intended to avoid the anti-pattern of having to import individual methods throughout code.
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-33/+15
2017-07-07syntax: Apply recovery for casts to type ascriptionVadim Petrochenkov-46/+53
Fix spans, add some comments
2017-07-07Fix spans for binary operator expression with interpolated identifiersVadim Petrochenkov-5/+12
2017-07-06Add extra whitespace for suggestionsEsteban Küber-4/+4
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-33/+17
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-32/+14
2017-06-27syntax: allow negative integer literal expression to be interpolated as patternAlex Burka-1/+3
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-5/+5
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-2/+2
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-1/+4
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-23Removed as many "```ignore" as possible.kennytm-1/+1
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-16Auto merge of #42578 - estebank:recover-binop, r=nikomatsakisbors-9/+91
Learn to parse `a as usize < b` Parsing `a as usize > b` always works, but `a as usize < b` was a parsing error because the parser would think the `<` started a generic type argument for `usize`. The parser now attempts to parse as before, and if a DiagnosticError is returned, try to parse again as a type with no generic arguments. If this fails, return the original `DiagnosticError`. Fix #22644.
2017-06-15Review commentsEsteban Küber-99/+71
- generate error instead of warning - remove `RewindPoint` and just keep a copy of `Parser` to rewind state. - `dont_parse_generics: bool` -> `parse_generics: bool` - remove `eat_lt` - move error handling code to separate method
2017-06-12Change `<` interpreted as generic arg start warningEsteban Küber-23/+33
``` warning: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | - ^ interpreted as generic argument | | | not interpreted as comparison | help: if you want to compare the casted value then write: | println!("{}", (a as usize) < b); ```
2017-06-12Fix affected testsEsteban Küber-1/+2
2017-06-11Suggest non-ambiguous comparison after castEsteban Küber-2/+19
``` warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here | help: if you want to compare the casted value then write | println!("{}", (a as usize) < b); ```
2017-06-11Learn to parse `a as usize < b`Esteban Küber-8/+90
Parsing `a as usize > b` always works, but `a as usize < b` was a parsing error because the parser would think the `<` started a generic type argument for `usize`. The parser now attempts to parse as before, and if a DiagnosticError is returned, try to parse again as a type with no generic arguments. If this fails, return the original `DiagnosticError`.
2017-06-07Replace some matches with try.Masaki Hara-4/+1
2017-06-02Rollup merge of #42319 - Manishearth:const-extern, r=nikomatsakisMark Simulacrum-0/+4
Improve error message for const extern fn It's currently ``error: unmatched visibility `pub` ``, which is a nonsensical error in this context.
2017-05-31Improve error message for const extern fnManish Goregaokar-0/+4
2017-05-31Emit proper expectation for the "default" keyword.Masaki Hara-2/+11
2017-05-31Parse macros named "default" correctly.Masaki Hara-19/+14
2017-05-25Hygienize lifetimes.Jeffrey Seyfried-1/+1
2017-05-25Declarative macros 2.0 without hygiene.Jeffrey Seyfried-21/+47
2017-05-25Refactor out `ast::MacroDef`.Jeffrey Seyfried-1/+3
2017-05-18Add an option to the parser to avoid parsing out of line modulesNick Cameron-2/+13
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-3/+3
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-38/+35
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-8/+8