Mazdak Farrokhzad
7c0b1da2c1
Win some lose some; Unfortunately we lost recovery in one case.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
e3cdadd73f
(pat, ..,) is now syntactically legal.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
06e5ae5c82
Account for better recovery in two cases.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
91c8b53f45
--bless tests due to new subslice syntax.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
75da43dc87
Use new 'p @ ..' syntax in tests.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
891a736b02
Test parsing and recovery of all sorts of range patterns.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
f6c8234f9f
And also --bless those recovery tests.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
2411134c78
Update tests wrt. recovery of range patterns.
2019-07-28 06:53:38 +02:00
Evgenii P
693be441f4
Fix ui/parser/attr test
2019-07-27 19:37:03 +07:00
Evgenii P
2787cb23f0
Fix failing UI tests
2019-07-27 18:24:48 +07:00
Evgenii P
8b3f28cf0f
Make more informative error on outer attr after inner
2019-07-27 16:45:45 +07:00
Esteban Küber
6263eb438d
ignore-tidy-trailing-newlines
2019-07-26 12:18:28 -07:00
Mazdak Farrokhzad
1893ac6db3
Rollup merge of #62963 - estebank:homoglyph-recovery, r=petrochenkov
...
Allow lexer to recover from some homoglyphs
2019-07-26 18:56:53 +02:00
Esteban Küber
eeb1bd18dc
Avoid ICE when suggestion span is at Eof
2019-07-25 16:06:24 -07:00
Mazdak Farrokhzad
c9a766ab47
Rollup merge of #62887 - estebank:issue-62881, r=petrochenkov
...
Make the parser TokenStream more resilient after mismatched delimiter recovery
Fix #62881 , fix #62895 .
2019-07-25 23:21:03 +02:00
Esteban Küber
70c817aee3
Allow lexer to recover from some homoglyphs
2019-07-24 16:10:42 -07:00
Mazdak Farrokhzad
c44e29bb59
Rollup merge of #62917 - estebank:trailing-slash, r=matklad
...
Always emit trailing slash error
Fix #62913 .
r? @petrochenkov
2019-07-24 16:13:20 +02:00
Esteban Küber
e26e6749fb
Always emit trailing slash error
2019-07-23 17:24:18 -07:00
Esteban Küber
fe2b5bbe6d
review comments
2019-07-23 12:51:34 -07:00
Mark Rousskov
ab7149bdc5
Rollup merge of #62791 - estebank:type-ascription, r=petrochenkov
...
Handle more cases of typos misinterpreted as type ascription
Fix #60933 , #54516 .
CC #47666 , #34255 , #48016 .
2019-07-23 12:51:07 -04:00
Aleksey Kladov
647bf96b79
fix lexing of comments with many \r
...
closes #62863
2019-07-22 15:39:06 +03:00
Aleksey Kladov
395ee0b79f
Introduce rustc_lexer
...
The idea here is to make a reusable library out of the existing
rust-lexer, by separating out pure lexing and rustc-specific concerns,
like spans, error reporting an interning.
So, rustc_lexer operates directly on `&str`, produces simple tokens
which are a pair of type-tag and a bit of original text, and does not
report errors, instead storing them as flags on the token.
2019-07-20 21:12:34 +03:00
Esteban Küber
f5b285906e
Handle more cases of typos misinterpreted as type ascription
2019-07-19 10:56:37 -07:00
Samy Kacimi
e5e1397adb
normalize use of backticks in compiler messages for librustc/lint
...
https://github.com/rust-lang/rust/issues/60532
2019-07-17 22:49:48 +02:00
Mark Rousskov
94b16d4bd0
Rollup merge of #62703 - fakenine:normalize_use_of_backticks_compiler_messages_p6, r=eddyb
...
normalize use of backticks in compiler messages for libsyntax/parse
https://github.com/rust-lang/rust/issues/60532
2019-07-16 11:38:58 -04:00
Mark Rousskov
f9576a6fce
Rollup merge of #62668 - goodmanjonathan:fix-62660, r=estebank
...
Fix #62660
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.
Fixes #62660 .
2019-07-15 19:55:10 -04:00
Samy Kacimi
7ddafaf6f9
normalize use of backticks in compiler messages for libsyntax/parse
...
https://github.com/rust-lang/rust/issues/60532
2019-07-16 00:07:30 +02:00
bors
d82fd9ecd3
Auto merge of #62643 - estebank:parse-recovery-type-errs, r=petrochenkov
...
Do not emit type errors after parse error in last statement of block
When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.
Fix #57383 .
2019-07-14 22:51:05 +00:00
Jonathan Goodman
7111328556
Don't drop DiagnosticBuilder if parsing fails
...
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.
Fixes #62660 .
2019-07-13 19:46:13 -05:00
Esteban Küber
8259a2dd42
Do not emit type errors after parse error in last statement of block
...
When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.
Fix #57383 .
2019-07-12 18:55:01 -07:00
Esteban Küber
e1c7747cf0
Handle errors during error recovery gracefully
2019-07-11 16:54:33 -07:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
...
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
Mazdak Farrokhzad
919349701a
Rollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
...
Migrate `compile-pass` annotations to `build-pass`
This is a part of #62277 .
As a first step, the `compile-pass` tests are migrated to `build-pass`.
r? @cramertj
cc @Centril
2019-07-04 01:38:58 +02:00
Yuki Okushi
c004451a20
Migrate compile-pass annotations to build-pass
2019-07-03 06:30:28 +09:00
Vadim Petrochenkov
3f39dc1b90
syntax: Unsupport foo! bar { ... } macros in the parser
...
Unreserve `macro_rules` as a macro name
2019-07-01 12:20:54 +03:00
John Wrenn
ac98342e84
Implement arbitrary_enum_discriminant
2019-06-21 11:00:10 -04:00
bors
4edff843dd
Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkov
...
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](9d1984d7ae/grammar/item.lyg (L3-L42) ), as written in [the *`.lyg`* notation](263bf161da (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-16 20:33:55 +00:00
bors
3f511ade5b
Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkov
...
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-12 07:38:01 +00:00
bors
5e2c11034f
Auto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkov
...
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-10 23:32:12 +00:00
Igor Matuszewski
630d5f355f
Don't suggest using \r in raw strings
2019-06-10 17:32:15 +02:00
Mazdak Farrokhzad
48e863ed69
Harden non-const items to not accept underscore names.
2019-06-10 06:17:39 +02:00
Caio
1eaaf440d5
Allow attributes in formal function parameters
2019-06-09 07:58:40 -03:00
Mazdak Farrokhzad
1e793c71b5
Update tests since ? macro op is supported on 2015.
2019-06-09 04:16:34 +02:00
Igor Matuszewski
49d62e8d5a
Prohibit bare CRs in raw byte strings
2019-06-08 22:58:53 +02:00
Igor Matuszewski
cab7e7fe76
Validate and transcribe raw strings via unescape module
2019-06-08 22:58:53 +02:00
bors
c57ed9d947
Auto merge of #61331 - estebank:fn-arg-parse-recovery, r=varkor
...
Recover gracefully from argument with missing type or param name
2019-06-03 05:40:53 +00:00
Mazdak Farrokhzad
23de376572
Rollup merge of #61403 - estebank:test-cleanup, r=petrochenkov
...
Remove unnecessary `-Z continue-parse-after-error` from tests
r? @petrochenkov
2019-06-01 06:50:10 +02:00
Esteban Küber
d6ea6b972d
fix tidy
2019-05-31 13:50:04 -07:00
Esteban Küber
860dce794c
Remove unecessary -Z continue-parse-after-error from tests
2019-05-30 18:57:17 -07:00
Esteban Küber
b3ac88ad92
Recover gracefully from argument with missing type or param name
2019-05-30 17:59:05 -07:00