summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
2017-01-06Add 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
2016-07-05Specific error message for missplaced doc commentsEsteban Küber-3/+115
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-06-29Rollup merge of #34460 - dsprenkels:issue-33455, r=alexcrichtonManish Goregaokar-0/+11
Add regression test for #33455 Closes #33455.
2016-06-25add regression test for #33455Daan Sprenkels-0/+11
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-0/+20
2016-05-27Auto merge of #33900 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-0/+18
Rollup of 10 pull requests - Successful merges: #33753, #33815, #33829, #33858, #33865, #33866, #33870, #33874, #33891, #33898 - Failed merges:
2016-05-26Address review commentsVadim Petrochenkov-1/+1
2016-05-26Implement `..` in tuple (struct) patternsVadim Petrochenkov-4/+104
2016-05-26Fix ICE on failure to parse token treeJeffrey Seyfried-0/+18
2016-05-14syntax: Refactor parsing of method declarationsVadim Petrochenkov-4/+22
Fix spans and expected token lists, fix #33413 + other cosmetic improvements Add test for #33413 Convert between `Arg` and `ExplicitSelf` precisely Simplify pretty-printing for methods
2016-05-07Rollup merge of #33336 - birkenfeld:issue-27361, r=sfacklerSteve Klabnik-2/+2
parser: do not try to continue with `unsafe` on foreign fns The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: ``` self.expect_keyword(keywords::Fn)?; ``` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
2016-05-07Auto merge of #33333 - birkenfeld:issue-30318, r=Manishearthbors-0/+19
parser: show a helpful note on unexpected inner comment Fixes: #30318.
2016-05-06Auto merge of #33311 - birkenfeld:issue33262, r=nrcbors-0/+18
parser: fix suppression of syntax errors in range RHS Invalid expressions on the RHS were just swallowed without generating an error. The new version more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method below, where no cancel is done either. Fixes #33262.
2016-05-03parser: show a helpful note on unexpected inner commentGeorg Brandl-0/+19
Fixes: #30318.
2016-05-02parser: change warning into an error on `T<A=B, C>`Georg Brandl-0/+17
Fixes: #32214
2016-05-02parser: do not try to continue with `unsafe` on foreign fnsGeorg Brandl-2/+2
The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: `self.expect_keyword(keywords::Fn)?;` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
2016-05-01parser: fix suppression of syntax errors in range RHSGeorg Brandl-0/+18
Invalid expressions on the RHS were just swallowed without generating an error. The new code more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method, where no cancel is done either. Fixes #33262.
2016-04-24Fix keyword parsing testsVadim Petrochenkov-60/+169
2016-04-24syntax: Make `is_path_start` precise and improve some error messages about ↵Vadim Petrochenkov-28/+16
unexpected tokens
2016-04-24syntax: Check paths in visibilities for type parametersVadim Petrochenkov-23/+9
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix syntax: Rename PathParsingMode and its variants to better express their purpose syntax: Remove obsolete error message about 'self lifetime syntax: Remove ALLOW_MODULE_PATHS workaround syntax/resolve: Adjust some error messages resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
2016-04-24syntax: Don't rely on token::IdentStyle in the parserVadim Petrochenkov-16/+0
2016-04-21port compiletest to use JSON outputNiko Matsakis-33/+1
This uncovered a lot of bugs in compiletest and also some shortcomings of our existing JSON output. We had to add information to the JSON output, such as suggested text and macro backtraces. We also had to fix various bugs in the existing tests. Joint work with jntrnr.
2016-04-17syntax: Parse import prefixes as pathsVadim Petrochenkov-1/+1
2016-04-14Improve message for raw pointer missing mut and constDavid Tolnay-1/+1
"Bare raw pointer" does not exist as a concept.
2016-04-12Bare raw pointers have been disallowed foreverDavid Tolnay-0/+15
This change was in 0.12.0, a year and a half ago. Let's move on!
2016-04-07add regression test for #32505Niko Matsakis-0/+17
2016-03-31Auto merge of #32506 - petrochenkov:use, r=Manishearthbors-2/+23
syntax: Extra diagnostics for `_` used in an identifier position Closes https://github.com/rust-lang/rust/issues/32501
2016-03-31Auto merge of #31938 - jseyfried:autoderef_privacy, r=nikomatsakisbors-3/+1
Integrate privacy into field and method selection This PR integrates privacy checking into field and method selection so that an inaccessible field/method can not stop an accessible field/method from being used (fixes #12808 and fixes #22684). r? @eddyb
2016-03-31syntax: Extra diagnostics for `_` used in an identifier positionVadim Petrochenkov-2/+23
2016-03-31Rollup merge of #32494 - pnkfelix:gate-parser-recovery-via-debugflag, r=nrcManish Goregaokar-11/+15
Gate parser recovery via debugflag Gate parser recovery via debugflag Put in `-Z continue_parse_after_error` This works by adding a method, `fn abort_if_no_parse_recovery`, to the diagnostic handler in `syntax::errors`, and calling it after each error is emitted in the parser. (We might consider adding a debugflag to do such aborts in other places where we are currently attempting recovery, such as resolve, but I think the parser is the really important case to handle in the face of #31994 and the parser bugs of varying degrees that were injected by parse error recovery.) r? @nikomatsakis
2016-03-30Fix fallout in testsJeffrey Seyfried-3/+1
2016-03-30fix compile-fail and parse-fail tests by blindly opting back intoFelix S. Klock II-11/+15
parser recovery (so that expected errors match up) I'm opting into parser recovery in all these cases out of expediency, not because the error messages you get with recovery enabled are actually all that usable in all cases listed.