about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2017-06-26Update and fix a few testsAlex Crichton-1/+1
2017-06-26Address review comments.Jeffrey Seyfried-13/+33
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-13/+54
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-6/+73
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-29/+34
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-06Auto merge of #41990 - ↵bors-0/+9
qnighy:disallow-underscore-suffix-for-string-like-literals, r=nikomatsakis Disallow underscore suffix for string-like literals. This patch turns string/bytestring/char/byte literals followed by an underscore, like `"Foo"_`, to an error. `scan_optional_raw_name` will parse `_` as a valid raw name, but it will be rejected by the parser. I also considered just stopping parsing when the suffix is `_`, but in that case `"Foo"_` will be lexed as two valid tokens. Fixes the latter half of #41723.
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-31Add warning cycle #42326.Masaki Hara-1/+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-24Rollup merge of #42120 - euclio:unicode, r=arielb1Mark Simulacrum-1/+1
remove "much" from unicode diagnostic The English seems slightly awkward to me, and it's unnecessary.
2017-05-20remove "much" from unicode diagnosticAndy Russell-1/+1
2017-05-18Add an option to the parser to avoid parsing out of line modulesNick Cameron-4/+36
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-16Rollup merge of #41957 - llogiq:clippy-libsyntax, r=petrochenkovMark Simulacrum-205/+195
Fix some clippy warnings in libsyntax This is mostly removing stray ampersands, needless returns and lifetimes. Basically a lot of small changes.
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-5/+4
2017-05-14Disallow underscore suffix for string-like literals.Masaki Hara-5/+1
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-205/+196
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-12Disallow ._ in float literal.Masaki Hara-3/+1
2017-05-08Rollup merge of #41827 - qnighy:allow-bare-cr-in-nondoc-comment, r=estebankCorey Farwell-1/+1
Allow bare CR in ////-style comment. Fixes #40624 in a way that bare CR is allowed in all non-doc comments.
2017-05-08Allow bare CR in ////-style comment.Masaki Hara-1/+1
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-8/+8
2017-05-07Auto merge of #41729 - ubsan:master, r=nrcbors-22/+26
Delete features which are easily removed, in libsyntax
2017-05-07fix the easy features in libsyntaxubsan-22/+26
2017-05-06Fix "an" usageacdenisSK-1/+1
2017-05-05Rollup merge of #41722 - F001:warnTilde, r=petrochenkovCorey Farwell-0/+13
Suggest `!` for bitwise negation when encountering a `~` Fix #41679 Here is a program ```rust fn main() { let x = ~1; } ``` It's output: ``` error: `~` can not be used as an unary operator --> /home/fcc/temp/test.rs:4:13 | 4 | let x = ~1; | ^^ | = help: use `!` instead of `~` if you meant to bitwise negation ``` cc @bstrie
2017-05-05Suggest `!` for bitwise negation when encountering a `~`F001-0/+13
2017-05-04Remove use of `Self: Sized` from libsyntaxTommy Ip-1/+1
The bound is not required for compiling but it prevents using `next_token()` from a trait object. Fixes #33506.
2017-05-02Auto merge of #40851 - oli-obk:multisugg, r=jonathandturnerbors-10/+7
Minimize single span suggestions into a label changes ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ | help: to access tuple elements, use tuple indexing syntax as shown | println!("☃{}", tup.0); ``` into ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ to access tuple elements, use `tup.0` ``` Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
2017-04-28Auto merge of #41542 - petrochenkov:objpars2, r=nikomatsakisbors-2/+2
syntax: Parse trait object types starting with a lifetime bound Fixes https://github.com/rust-lang/rust/issues/39085 This was originally implemented in https://github.com/rust-lang/rust/pull/40043, then reverted, then there was some [agreement](https://github.com/rust-lang/rust/issues/39318#issuecomment-289108720) that it should be supported. (This is hopefully the last PR related to bound parsing.)
2017-04-28Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichtonbors-26/+26
Implement a file-path remapping feature in support of debuginfo and reproducible builds This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler. This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages. r? @alexcrichton
2017-04-27Auto merge of #37860 - giannicic:defaultimpl, r=nagisabors-7/+27
#37653 support `default impl` for specialization this commit implements the first step of the `default impl` feature: > all items in a `default impl` are (implicitly) `default` and hence > specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See [referenced](https://github.com/rust-lang/rust/issues/37653) issue for further info r? @aturon
2017-04-26 support `default impl` for specializationGianni Ciccarelli-9/+6
`[default] [unsafe] impl` and typecheck
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-26/+26
reproducible builds.
2017-04-25Parse trait object types starting with a lifetime boundVadim Petrochenkov-2/+2
2017-04-25Add ui testsGuillaume Gomez-7/+4
2017-04-25Improve E0178 suggestion placementOliver Schneider-4/+5
2017-04-25Address PR commentsOliver Schneider-3/+1
2017-04-25Update affected testsOliver Schneider-3/+1