summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
2017-11-10Auto merge of #45773 - Badel2:dotdoteq, r=petrochenkovbors-0/+38
Add error for `...` in expressions Follow-up to https://github.com/rust-lang/rust/pull/44709 Tracking issue: https://github.com/rust-lang/rust/issues/28237 * Using `...` in expressions was a warning, now it's an error * The error message suggests using `..` or `..=` instead, and explains the difference * Updated remaining occurrences of `...` to `..=` r? petrochenkov
2017-11-06Test error for `...` in expressionsBadel2-0/+38
2017-11-03Detect `=` -> `:` typo in let bindingsEsteban Küber-1/+0
When encountering a let binding type error, attempt to parse as initializer instead. If successful, it is likely just a typo: ```rust fn main() { let x: Vec::with_capacity(10); } ``` ``` error: expected type, found `10` --> file.rs:3:31 | 3 | let x: Vec::with_capacity(10, 20); | -- ^^ | || | |help: did you mean assign here?: `=` | while parsing the type for `x` ```
2017-10-22`crate` shorthand visibility modifierZack M. Davis-3/+3
With regrets, this breaks rustfmt and rls. This is in the matter of #45388.
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-0/+2
2017-10-10output compiler message updatedJean Lourenço-1/+2
output message is shown in another 'help:' block line with +100 columns formatted test adjusted
2017-09-22Add support for `..=` syntaxAlex Burka-12/+13
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-12Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkovbors-9/+22
Accept underscores in unicode escapes Fixes #43692. I don't know if this need an RFC, but at least the impl is here!
2017-08-31Auto merge of #43425 - matklad:lambda-restrictions, r=eddybbors-0/+29
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-17Accept underscores in unicode escapesMalo Jaffré-9/+22
Fixes #43692.
2017-08-11syntax: Relax path grammarVadim Petrochenkov-30/+2
2017-07-27Simplify parsing of pathsVadim Petrochenkov-2/+4
2017-07-23Fix some doc/comment typos.Bruce Mitchener-1/+1
2017-07-23Lambda expressions honor no struct literal restrictionAleksey Kladov-0/+29
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-1/+1
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-1/+1
2017-06-06Auto merge of #41990 - ↵bors-0/+20
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-05-31Improve error message for const extern fnManish Goregaokar-1/+1
2017-05-31Add warning cycle #42326.Masaki Hara-1/+8
2017-05-20remove "much" from unicode diagnosticAndy Russell-2/+1
2017-05-14Disallow underscore suffix for string-like literals.Masaki Hara-0/+13
2017-05-12Disallow ._ in float literal.Masaki Hara-0/+13
2017-05-08Allow bare CR in ////-style comment.Masaki Hara-0/+6
2017-04-25Fix a parse-fail testOliver Schneider-1/+0
2017-04-21Fix issue with single question mark or parenVadim Petrochenkov-0/+13
2017-04-21syntax: Support parentheses around trait boundsVadim Petrochenkov-0/+59
2017-04-17Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkovbors-6/+5
libsyntax/parse: fix missing kind error reporting Fixes #41161. Fixes #41239.
2017-04-17libsyntax/parse: improve associated item error reportingAriel Ben-Yehuda-6/+5
Fixes #41161. Fixes #41239.
2017-04-12Rollup merge of #41087 - estebank:tuple-float-index, r=arielb1Tim Neumann-17/+0
Use proper span for tuple index parsed as float Fix diagnostic suggestion from: ```rust help: try parenthesizing the first index | (1, (2, 3)).((1, (2, 3)).1).1; ``` to the correct: ```rust help: try parenthesizing the first index | ((1, (2, 3)).1).1; ``` Fix #41081.
2017-04-05Use proper span for tuple index parsed as floatEsteban Küber-17/+0
Fix diagnostic suggestion from: ```rust help: try parenthesizing the first index | (1, (2, 3)).((1, (2, 3)).1).1; ``` to the correct: ```rust help: try parenthesizing the first index | ((1, (2, 3)).1).1; ```
2017-04-04Merge branch 'master' into issue-32540Esteban Küber-0/+34
2017-03-30Replace hardcoded forward slash with path::MAIN_SEPARATORThomas Jespersen-0/+34
Fixes #40149
2017-03-25Improve wording and spans for unexpected tokenEsteban Küber-39/+1
* Point at where the token was expected instead of the last token successfuly parsed. * Only show `unexpected token` if the next char and the unexpected token don't have the same span. * Change some cfail and pfail tests to ui test. * Don't show all possible tokens in span label if they are more than 6.
2017-03-24Point at last valid token on failed `expect_one_of`Esteban Küber-3/+9
```rust error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` --> $DIR/token-error-correct-3.rs:29:9 | 25 | foo() | - expected one of `.`, `;`, `?`, `}`, or an operator after this ... 29 | } else { | ^ unexpected token ```
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-7/+46
2017-03-14Liberalize attributes.Jeffrey Seyfried-44/+1
2017-02-28Add warning cycle.Jeffrey Seyfried-0/+2
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-1/+1
`tokenstream::TokenTree::Sequence`.
2017-02-23Added test for inclusive_range_syntax in compile-fail test suiteNikhil Shagrithaya-0/+2
2017-02-15Stabilize field init shorthandest31-2/+0
Closes #37340.
2017-02-09change span_notes to notes in E0368/E0369Alex Burka-28/+0
2017-02-02Rollup merge of #39420 - oli-obk:sugg, r=pnkfelixGuillaume Gomez-1/+2
parser: use suggestions instead of helps with code in them
2017-01-31use suggestions instead of helps with code in themOliver Schneider-1/+2
2017-01-28Add clearer error message using `&str + &str`Michael Gattozzi-0/+28
This is the first part of #39018. One of the common things for new users coming from more dynamic languages like JavaScript, Python or Ruby is to use `+` to concatenate strings. However, this doesn't work that way in Rust unless the first type is a `String`. This commit adds a check for this use case and outputs a new error as well as a suggestion to guide the user towards the desired behavior. It also adds a new test case to test the output of the error.
2017-01-27Auto merge of #39158 - petrochenkov:bounds, r=nikomatsakisbors-15/+144
Bounds parsing refactoring 2 See https://github.com/rust-lang/rust/pull/37511 for previous discussion. cc @matklad Relaxed parsing rules: - zero bounds after `:` are allowed in all contexts. - zero predicates are allowed after `where`. - trailing separator `,` is allowed after predicates in `where` clauses not followed by `{`. Other parsing rules: - trailing separator `+` is still allowed in all bound lists. Code is also cleaned up and tests added. I haven't touched parsing of trait object types yet, I'll do it later.
2017-01-25Auto merge of #35712 - oli-obk:exclusive_range_patterns, r=nikomatsakisbors-20/+2
exclusive range patterns adds `..` patterns to the language under a feature gate (`exclusive_range_pattern`). This allows turning ``` rust match i { 0...9 => {}, 10...19 => {}, 20...29 => {}, _ => {} } ``` into ``` rust match i { 0..10 => {}, 10..20 => {}, 20..30 => {}, _ => {} } ```
2017-01-24parser: Permit trailing +'s in bound listsVadim Petrochenkov-50/+8
2017-01-24Improve some expected/found error messages from parserVadim Petrochenkov-2/+2
2017-01-24Add testsVadim Petrochenkov-0/+179
2017-01-24Refactor parsing of generic arguments/parameters and where clausesVadim Petrochenkov-15/+7