summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
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
2017-01-20Rollup merge of #39179 - petrochenkov:objparen, r=eddybAlex Crichton-0/+15
Fix regression in parsing of trait object types Fixes https://github.com/rust-lang/rust/issues/39169 Accepting parens in this position is a regression itself, introduced in Rust 1.6 by https://github.com/rust-lang/rust/pull/29870, so I hope to revert this in my next bounds refactoring patch (possibly with a warning, crater run, etc). r? @eddyb
2017-01-19Fix regression in parsing of trait object typesVadim Petrochenkov-0/+15
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-20/+2
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-1/+1
2016-12-30Fix parse-fail and compile-fail testsSimonas Kazlauskas-6/+6
2016-12-09Add test.Without Boats-0/+16
2016-11-22Fix fallout in tests.Jeffrey Seyfried-0/+1
2016-11-21Fix fallout in `rustdoc` and tests.Jeffrey Seyfried-1/+1
2016-11-14Auto merge of #37278 - matklad:lone-lifetime, r=jseyfriedbors-1/+4
Fix syntax error in the compiler Currently `rustc` accepts the following code: `fn f<'a>() where 'a {}`. This should be a syntax error, shouldn't it? Not sure if my changes actually compile, waiting for the LLVM to build.
2016-11-14Fix where clauses parsingAleksey Kladov-2/+5
Don't allow lifetimes without any bounds at all
2016-11-11Auto merge of #37246 - goffrie:no-loop, r=jseyfriedbors-0/+19
Don't spin expanding stmt macros. If we can't make progress when parsing a macro expansion as a statement then we should just bail. This alleviates the symptoms shown in e.g. #37113 and #37234 but it doesn't fix the problem that parsing invalid enum bodies (and others) leaves the parser in a crappy state. I'm not sold on this strategy (checking `tokens_consumed`), so if anyone has a better idea, I'm all ears!
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-1/+2
2016-11-01add -Z continue-parse-after-error to parse-fail testsNiko Matsakis-13/+15
The new handling fixed a latent bug in the parser error handling where it would only abort after the second error (when configured to stop after the first error). This is because the check for `error_count != 0` was occuring before the increment. Since the increment is tied to the `emit()` call now this no longer occurs.
2016-10-31Changed most vec! invocations to use square bracesiirelu-1/+1
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-27Auto merge of #37245 - goffrie:recovery, r=nrcbors-0/+102
Recover out of an enum or struct's braced block. If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-26Don't spin expanding stmt macros.Geoffry Song-0/+19
If we can't make progress when parsing a macro expansion as a statement then we should just bail. This alleviates the symptoms shown in e.g. #37113 but it doesn't fix the problem that parsing invalid enum bodies (and others) leaves the parser in a crappy state.
2016-10-26Recover out of an enum or struct's braced block.Geoffry Song-0/+102
If we encounter a syntax error inside of a braced block, then we should fail by consuming the rest of the block if possible. This implements such recovery for enums and structs. Fixes #37113.
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-1/+20
2016-10-20Tweak path parsing logicVadim Petrochenkov-45/+0
2016-09-23Fix fallout in tests.Jeffrey Seyfried-2/+3
2016-09-13Remove parsing of obsolete pre-1.0 syntaxesVadim Petrochenkov-18/+0
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-17/+25
2016-08-19Auto merge of #33922 - estebank:doc-comment, r=alexcrichtonbors-3/+115
Specific error message for missplaced doc comments Identify when documetation comments have been missplaced in the following places: * After a struct element: ```rust // file.rs: struct X { a: u8 /** document a */, } ``` ```bash $ rustc file.rs file.rs:2:11: 2:28 error: found documentation comment that doesn't document anything file.rs:2 a: u8 /** document a */, ^~~~~~~~~~~~~~~~~ file.rs:2:11: 2:28 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a struct: ```rust // file.rs: struct X { a: u8, /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a `fn`: ```rust // file.rs: fn main() { let x = 1; /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` Fix #27429, #30322
2016-07-15syntax: Better error message for inner attr following doc commentAravind Gollakota-0/+36