summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2019-08-05bless ui testsPietro Albini-1/+1
2019-08-03review commentsEsteban Küber-0/+95
2019-07-22Rollup merge of #62792 - goodmanjonathan:beta, r=estebankPietro Albini-0/+19
2019-07-22Handle errors during error recovery gracefullyEsteban Küber-0/+20
2019-07-18Don't drop DiagnosticBuilder if parsing failsJonathan Goodman-0/+19
Beta backport of #62668. If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE.
2019-06-21Implement arbitrary_enum_discriminantJohn Wrenn-13/+21
2019-06-16Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkovbors-11/+122
Stabilize underscore_const_names in 1.37.0 You are now permitted to write: ```rust const _: $type_expression = $term_expression; ``` That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" } | ... ; ``` into: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" } | ... ; IdentOrUnderscore = | Named:IDENT | NoName:"_" ; ``` r? @petrochenkov
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-32/+32
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-10Auto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkovbors-7/+16
lexer: Disallow bare CR in raw byte strings Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings. As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it. @matklad @petrochenkov thoughts?
2019-06-10Don't suggest using \r in raw stringsIgor Matuszewski-4/+4
2019-06-10Harden non-const items to not accept underscore names.Mazdak Farrokhzad-11/+122
2019-06-09Allow attributes in formal function parametersCaio-32/+32
2019-06-09Update tests since ? macro op is supported on 2015.Mazdak Farrokhzad-2/+2
2019-06-08Prohibit bare CRs in raw byte stringsIgor Matuszewski-4/+13
2019-06-08Validate and transcribe raw strings via unescape moduleIgor Matuszewski-4/+4
2019-06-03Auto merge of #61331 - estebank:fn-arg-parse-recovery, r=varkorbors-1/+23
Recover gracefully from argument with missing type or param name
2019-06-01Rollup merge of #61403 - estebank:test-cleanup, r=petrochenkovMazdak Farrokhzad-167/+104
Remove unnecessary `-Z continue-parse-after-error` from tests r? @petrochenkov
2019-05-31fix tidyEsteban Küber-166/+103
2019-05-30Remove unecessary `-Z continue-parse-after-error` from testsEsteban Küber-31/+31
2019-05-30Recover gracefully from argument with missing type or param nameEsteban Küber-1/+23
2019-05-30Explicitly suggest 'type_ascription' featureJanusz Marcinkiewicz-1/+1
2019-05-28Update test/ui/parser for bare_trait_object warningsmemoryruins-12/+43
2019-05-25review comments: move back some methods and clean up wordingEsteban Küber-4/+4
2019-05-25Tweak `self` arg not as first argument of a method diagnosticEsteban Küber-0/+13
Mention that `self` is only valid on "associated functions" ``` error: unexpected `self` argument in function --> $DIR/self-in-function-arg.rs:1:15 | LL | fn foo(x:i32, self: i32) -> i32 { self } | ^^^^ not valid as function argument | = note: `self` is only valid as the first argument of an associated function ``` When it is a method, mention it must be first ``` error: unexpected `self` argument in function --> $DIR/trait-fn.rs:4:20 | LL | fn c(foo: u32, self) {} | ^^^^ must be the first associated function argument ```
2019-05-24review commentsEsteban Küber-0/+0
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-0/+12
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-24Auto merge of #60803 - varkor:remove-in-place-syntax, r=petrochenkovbors-3/+0
Remove `ObsoleteInPlace` The in place syntax has been deprecated for over a year. As it is, this is accumulated cruft: the error messages are unlikely to be helpful any more and it conflicts with some useful syntax (e.g. const generics in some instances). It may be that removing `Token::LArrow` is backwards-incompatible. We should do a crater run to check. cc @eddyb
2019-05-24Update testsvarkor-3/+0
2019-05-24Rollup merge of #61056 - euclio:custom-discriminant-error, r=estebankMazdak Farrokhzad-10/+18
tweak discriminant on non-nullary enum diagnostic Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference. Fixes #61039. r? @estebank
2019-05-23tweak discriminant on non-nullary enum diagnosticAndy Russell-10/+18
Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference.
2019-05-23syntax: Some code cleanupVadim Petrochenkov-15/+17
2019-05-23syntax: More consistent wording for some literal parsing errorsVadim Petrochenkov-16/+16
2019-05-23syntax: Return named errors from literal parsing functionsVadim Petrochenkov-3/+3
2019-05-20Reinstated shallow disallowing of maybe bounds in trait objects.Alexander Regueiro-2/+16
2019-05-20Update tests.Alexander Regueiro-17/+3
2019-05-11Move literal parsing code into a separate fileVadim Petrochenkov-4/+4
Remove some dead code
2019-05-09Rollup merge of #60188 - estebank:recover-block, r=varkorMazdak Farrokhzad-8/+186
Identify when a stmt could have been parsed as an expr There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar. Fix #54186, cc #54482, fix #59975, fix #47287.
2019-05-02fix typoEsteban Küber-12/+12
2019-05-02introduce unescape moduleAleksey Kladov-77/+120
Currently, we deal with escape sequences twice: once when we lex a string, and a second time when we unescape literals. This PR aims to remove this duplication, by introducing a new `unescape` mode as a single source of truth for character escaping rules
2019-04-30Reword ambigous parse error to fit with the current errorEsteban Küber-8/+8
2019-04-29Add test case for #47287Esteban Küber-1/+25
2019-04-29Identify when a stmt could have been parsed as an exprEsteban Küber-3/+157
There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar.
2019-04-25Rollup merge of #60160 - xldenis:fix-overlapping-zero-width-annotation, ↵Mazdak Farrokhzad-3/+2
r=estebank Fix #58270, fix off-by-one error in error diagnostics. This fixes #58270 by checking if two diagnostics overlap completely when we're calculating the line offset for each message.
2019-04-23Remove unnecessary tidy ignore directivesvarkor-8/+5
2019-04-22Fix #58270, fix off-by-one error in error diagnostics.Xavier Denis-3/+2
2019-04-19Some cleanup to `maybe_parse_struct_expr`Vadim Petrochenkov-0/+1
2019-04-19Emit specific error for struct literal in conditionsEsteban Küber-156/+92
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-8/+6
2019-04-11review commentsEsteban Küber-2/+2
2019-04-10Recover from missing semicolon based on the found tokenEsteban Küber-0/+52
When encountering one of a few keywords when a semicolon was expected, suggest the semicolon and recover: ``` error: expected one of `.`, `;`, `?`, or an operator, found `let` --> $DIR/recover-missing-semi.rs:4:5 | LL | let _: usize = () | - help: missing semicolon here LL | LL | let _ = 3; | ^^^ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 | LL | let _: usize = () | ^^ expected usize, found () | = note: expected type `usize` found type `()` ```