about summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
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.
2016-03-28Auto merge of #32479 - eddyb:eof-not-even-twice, r=nikomatsakisbors-2/+18
Prevent bumping the parser past the EOF. Makes `Parser::bump` after EOF into an ICE, forcing callers to avoid repeated EOF bumps. This ICE is intended to break infinite loops where EOF wasn't stopping the loop. For example, the handling of EOF in `parse_trait_items`' recovery loop fixes #32446. But even without this specific fix, the ICE is triggered, which helps diagnosis and UX. This is a `[breaking-change]` for plugins authors who eagerly eat multiple EOFs. See https://github.com/docopt/docopt.rs/pull/171 for such an example and the necessary fix.
2016-03-28Auto merge of #32267 - durka:inclusive-range-error, r=nrcbors-2/+3
melt the ICE when lowering an impossible range Emit a fatal error instead of panicking when HIR lowering encounters a range with no `end` point. This involved adding a method to wire up `LoweringContext::span_fatal`. Fixes #32245 (cc @nodakai). r? @nrc
2016-03-26syntax: Stop the bump loop for trait items at } and EOF.Eduard Burtescu-2/+18
2016-03-24address nitsAlex Burka-1/+1
2016-03-24fatal error instead of ICE for impossible range during HIR loweringAlex Burka-2/+3
End-less ranges (`a...`) don't parse but bad syntax extensions could conceivably produce them. Unbounded ranges (`...`) do parse and are caught here. The other panics in HIR lowering are all for unexpanded macros, which cannot be constructed by bad syntax extensions.
2016-03-24TestsNick Cameron-23/+2
2016-03-14Parse fail test fixesAaron Turon-3/+3
2016-03-14Add `default` as contextual keyword, and parse it for impl items.Aaron Turon-0/+35
2016-03-09Auto merge of #32071 - jseyfried:parse_pub, r=nikomatsakisbors-19/+0
Make errors for unnecessary visibility qualifiers consistent This PR refactors away `syntax::parse::parser::ParsePub` so that unnecessary visibility qualifiers on variant fields are reported not by the parser but by `privacy::SanePrivacyVisitor` (thanks to @petrochenkov's drive-by improvements in #31919). r? @nikomatsakis
2016-03-07update error messages in parse-fail testsJorge Aparicio-14/+14
2016-03-06Update testsJeffrey Seyfried-19/+0
2016-02-27test inclusive rangesAlex Burka-0/+92
Mostly copy the tests from half-open ranges, adding some more for DoubleEndedIterator and ExactSizeIterator. Also thoroughly (I think) test that the feature gates are working.
2016-02-15Some error recovery in the parserNick Cameron-5/+19
2016-02-15Add some simple error recovery to the parser and fix testsNick Cameron-21/+6
Some tests just add the extra errors, others I fix by doing some simple error recovery. I've tried to avoid doing too much in the hope of doing something more principled later. In general error messages are getting worse at this stage, but I think in the long run they will get better.
2016-02-08Breaking tokens into pieces should behave similar to Parser::bump.Tomasz Miąsko-0/+20
Previously when breaking tokens into smaller pieces, the replace_token function have been used. It replaced current token and updated span information, but it did not clear the list of expected tokens, neither did it update remaining info about last token. This could lead to incorrect error message, like one described in the issue #24780: expected one of ... `>` ... found `>`
2016-01-15Auto merge of #30763 - gchp:issue/30033, r=nagisabors-6/+66
This is achieved by adding the scan_back method. This method looks back through the source_text of the StringReader until it finds the target char, returning it's offset in the source. We use this method to find the offset of the opening single quote, and use that offset as the start of the error. Given this code: ```rust fn main() { let _ = 'abcd'; } ``` The compiler would give a message like: ``` error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ ``` With this change, the message now displays: ``` error: character literal may only contain one codepoint: 'abcd'; let _ = 'abcd'; ^~~~~~~ ``` Fixes #30033
2016-01-14Display better snippet for invalid char literalGreg Chapple-6/+66
Given this code: fn main() { let _ = 'abcd'; } The compiler would give a message like: error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ With this change, the message now displays: error: character literal may only contain one codepoint: 'abcd' let _ = 'abcd' ^~~~~~ Fixes #30033
2016-01-10Cancel parse_ty error in Parser::parse_generic_values_after_ltFlorian Hahn-0/+19
2016-01-06Auto merge of #30654 - nrc:panictry, r=brsonbors-1/+2
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery. [breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-31Auto merge of #30598 - est31:macro_export_help_note, r=Manishearthbors-0/+89
The current help message is too much about "normal" macros to be used as general message. Keep it for normal macros, and add custom help and error messages for macro definitions.
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-1/+2
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30Auto merge of #30375 - aaronkeen:issue_28777, r=eddybbors-16/+0
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to contain braces. https://github.com/rust-lang/rust/issues/28777
2015-12-30Move pub-{item,methd}-macro.rs to the parse-fail subdir as wellest31-0/+62