Commit Graph

505 Commits

Author SHA1 Message Date
Esteban Küber
d72ef21ddd Reword type ascription note to reduce verbosity 2019-03-22 20:14:20 -07:00
Esteban Küber
44a086ef39 Review comment 2019-03-22 19:50:18 -07:00
Esteban Küber
8ba1a97e37 Expand suggestions for type ascription parse errors 2019-03-22 19:50:18 -07:00
Mazdak Farrokhzad
9d33d6fa4b Rollup merge of #59322 - estebank:diag-tweak, r=davidtwco
Tweak incorrect escaped char diagnostic
2019-03-22 19:31:34 +01:00
Mazdak Farrokhzad
5a0e4510a8 Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkov
Do not complain about non-existing fields after parse recovery

When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.

Fix #57361.
2019-03-22 19:31:24 +01:00
Esteban Küber
a8120d660a Tweak incorrect escaped char diagnostic 2019-03-20 11:45:25 -07:00
Esteban Küber
6007e6f649 Do not complain about non-existing fields after parse recovery
When failing to parse struct-like enum variants, the ADT gets recorded
as having no fields. Record that we have actually recovered during
parsing of this variant to avoid complaing about non-existing fields
when actually using it.
2019-03-17 20:09:53 -07:00
Esteban Küber
b2b9555f95 Recover from incorrect pub kw in "reasonable" places 2019-03-16 17:47:57 -07:00
Esteban Küber
532dd4475b Recover from missing comma between enum variants 2019-03-16 17:47:00 -07:00
Vadim Petrochenkov
6ad55b3dec syntax: Introduce Ident::can_be_raw 2019-03-16 23:13:15 +03:00
Esteban Küber
6cd6759cfc Do not complain about unmentioned fields in recovered patterns
When the parser has to recover from malformed code in a pattern, do not
complain about missing fields.
2019-03-14 18:28:24 -07:00
Andy Russell
5abd6d9492 add suggestions to invalid macro item error 2019-03-13 15:24:36 -04:00
Saleem Jaffer
d258481625 tidy test 2019-03-13 11:53:06 +05:30
Saleem Jaffer
eaff0fe36f adding test 2019-03-13 09:58:05 +05:30
Mazdak Farrokhzad
ad7b650815 Rollup merge of #58876 - estebank:numeric-lifetime, r=petrochenkov
Parse lifetimes that start with a number and give specific error

Fix #58786.
2019-03-13 03:33:36 +01:00
Vadim Petrochenkov
07f99b9fec Update tests that don't run on my platform 2019-03-11 23:30:10 +03:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Esteban Küber
f690821d58 review comments 2019-03-09 11:08:51 -08:00
Esteban Küber
0a505a71d3 Parse lifetimes that start with a number and give specific error 2019-03-08 16:56:31 -08:00
Esteban Küber
3818f8ba34 Add regression test for #58886 2019-03-06 18:46:11 -08:00
Esteban Küber
cc535a2a19 Bail when encountering a second unexpected token in the same span 2019-03-06 18:45:59 -08:00
Dan Robertson
08bd4ff998 Rename variadic to c_variadic
Function signatures with the `variadic` member set are actually
C-variadic functions. Make this a little more explicit by renaming the
`variadic` boolean value, `c_variadic`.
2019-02-27 10:21:54 -05:00
Dan Robertson
58147d486b Support defining C compatible variadic functions
Add support for defining C compatible variadic functions in unsafe rust
with extern "C".
2019-02-27 10:21:35 -05:00
Vadim Petrochenkov
eccc19996b Stabilize unrestricted_attribute_tokens 2019-02-25 23:21:54 +03:00
Vadim Petrochenkov
8e1b5d897a Restrict value in key-value attributes to literals 2019-02-25 22:40:38 +03:00
Mazdak Farrokhzad
ae646687e0 Rollup merge of #57364 - hdhoang:33418_negative_bounds, r=estebank
Improve parsing diagnostic for negative supertrait bounds

closes #33418

r? @estebank
2019-02-24 05:55:55 +01:00
Mazdak Farrokhzad
18dd2d2fbe Rollup merge of #58526 - pmccarter:master, r=estebank
Special suggestion for illegal unicode curly quote pairs

Fixes #58436

Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark.

The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
2019-02-23 09:25:27 +01:00
Hoàng Đức Hiếu
7cfddfb4e4 Improve parsing diagnostic for negative supertrait bounds 2019-02-23 07:58:16 +07:00
Mazdak Farrokhzad
894141b57d Rollup merge of #58198 - igorsdv:suggest-removing-parentheses-surrounding-lifetimes, r=estebank
Suggest removing parentheses surrounding lifetimes

Fixes #57386.

r? @estebank
2019-02-22 14:57:59 +01:00
Patrick McCarter
71cd4c8e4a ui test for directed quote help suggestion #58436 2019-02-16 20:56:12 -05:00
bors
3315728c06 Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obk
Deduplicate mismatched delimiter errors

Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.

Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-09 20:15:57 +00:00
Igor Sadikov
f753d304c6 Suggest removing parentheses surrounding lifetimes 2019-02-07 16:13:19 -05:00
varkor
455d659e91 Update tests
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07 15:02:17 +01:00
Esteban Küber
336c48cc7b tweak wording based on in person feedback 2019-02-07 01:42:54 -08:00
Esteban Küber
7451cd8dc0 Deduplicate mismatched delimiter errors
Delay unmatched delimiter errors until after the parser has run to
deduplicate them when parsing and attempt recovering intelligently.
2019-02-07 01:41:30 -08:00
Mark Rousskov
e0bc0ba281 Update comment in test which has changed its purpose 2019-01-27 08:59:58 -07:00
David Wood
463e623ca9 Suggestion moving types before associated types.
This commit extends existing suggestions to move lifetimes before types
in generic arguments to also suggest moving types behind associated type
bindings.
2019-01-25 11:15:16 +01:00
Mazdak Farrokhzad
da182a0fe7 Rollup merge of #57795 - estebank:did-you-mean, r=zackmdavis
Use structured suggestion in stead of notes
2019-01-24 00:19:55 +01:00
Mazdak Farrokhzad
2dd63a2e10 Rollup merge of #57779 - estebank:recover-struct-fields, r=davidtwco
Recover from parse errors in literal struct fields and incorrect float literals

Fix #52496.
2019-01-24 00:19:53 +01:00
Esteban Küber
4745b86202 Accept more invalid code that is close to correct fields 2019-01-21 15:47:23 -08:00
Esteban Küber
45a95b512c Use structured suggestion in stead of notes 2019-01-20 21:41:25 -08:00
Mazdak Farrokhzad
00c60d115c Rollup merge of #57784 - JohnTitor:improve-error-message, r=estebank
Add span for bad doc comment

Fixes #57382

r? @estebank
2019-01-21 02:21:58 +01:00
Mazdak Farrokhzad
627e001a72 Rollup merge of #57768 - estebank:type-args-sugg, r=zackmdavis
Continue parsing after parent type args and suggest using angle brackets

```
error[E0214]: parenthesized parameters may only be used with a trait
--> $DIR/E0214.rs:2:15
   |
LL |     let v: Vec(&str) = vec!["foo"];
   |               ^^^^^^
   |               |
   |               only traits may use parentheses
   |               help: use angle brackets instead: `<&str>`
```

r? @zackmdavis
2019-01-21 02:21:55 +01:00
Esteban Küber
defa61f3fb Tweak field parse error recovery 2019-01-20 15:16:36 -08:00
Yuki Okushi
b97c9641f5 Fix tests 2019-01-21 04:52:30 +09:00
Esteban Küber
b1f169fe7a Recover from parse errors in struct literal fields
Attempt to recover from parse errors while parsing a struct's literal fields
by skipping tokens until a comma or the closing brace is found. This allows
errors in other fields to be reported.
2019-01-20 00:37:06 -08:00
bors
2ab5d8ac44 Auto merge of #57651 - JohnTitor:give-char-type, r=estebank
Implement new literal type `Err`

Fixes #57384

I removed `return Ok`, otherwise, two errors occur. Any solutions?

r? @estebank
2019-01-20 08:26:12 +00:00
Yuki Okushi
4005d3a8cb Remove whitespace 2019-01-20 14:59:10 +09:00
Yuki Okushi
7ce2514419 Fix tests 2019-01-20 14:53:28 +09:00
Esteban Küber
d37a6d83e1 Suggest usage of angle brackets 2019-01-19 19:39:58 -08:00