about summary refs log tree commit diff
path: root/src/test/parse-fail
AgeCommit message (Collapse)AuthorLines
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
2015-12-30Move pub-macro-rules.rs test to parse-fail directoryest31-0/+27
2015-12-17Removed test case. This now test successfully parses with theAaron Keen-16/+0
modification to parsing of binary operators. This is consistent with the behavior of grammar/parser-lalr.
2015-12-16Implement type ascription.Eduard Burtescu-3/+3
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-73/+3
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-17Detect confusing unicode characters and show the alternativeRavi Shankar-0/+18
2015-11-09syntax: Merge parsing code for structures and variantsVadim Petrochenkov-25/+0
2015-11-05Improve error message for char literalsSteve Klabnik-2/+2
If you try to put something that's bigger than a char into a char literal, you get an error: fn main() { let c = 'ஶ்ரீ'; } error: unterminated character constant: This is a very compiler-centric message. Yes, it's technically 'unterminated', but that's not what you, the user did wrong. Instead, this commit changes it to error: character literal may only contain one codepoint As this actually tells you what went wrong. Fixes #28851
2015-10-28libsyntax: improve error message when a statement is prefixed with a match ↵Kevin Butler-0/+18
keyword
2015-10-27Add tests for newly introduced syntaxSimonas Kazlauskas-0/+54
Also add some (regression) tests for discovered parser oddities
2015-10-27Generalise associative operator parsingSimonas Kazlauskas-35/+0
This commit generalises parsing of associative operators from left-associative only (with some ugly hacks to support right-associative assignment) to properly left/right-associative operators. Parsing still is not general enough to handle non-associative, non-highest-precedence prefix or non-highest-precedence postfix operators (e.g. `..` range syntax), though. That should be fixed in the future. Lastly, this commit adds support for parsing right-associative `<-` (left arrow) operator with precedence higher than assignment as the operator for placement-in feature.
2015-10-25libsyntax: better error for lifetimes in patternsKevin Butler-0/+16
Previously, if you copied a signature from a trait definition such as: ``` fn foo<'a>(&'a Bar) -> bool {} ``` and moved it into an `impl`, there would be an error message: "unexpected token `'a`" Adding to the error message that a pattern is expected should help users to find the actual problem with using a lifetime here.
2015-10-13Test and gate empty structures and variants betterVadim Petrochenkov-15/+0
2015-10-13Unify structures and enum variants in ASTVadim Petrochenkov-15/+0