Vadim Petrochenkov
310b9fc760
libsyntax: Unconfigure tests during normal build
2019-08-02 01:59:01 +03:00
Pietro Albini
7a7fcad675
Rollup merge of #63170 - matklad:cleanup-fields, r=petrochenkov
...
cleanup StringReader fields
reduce visibility and replace `Lrc<SourceFile>` with `start_pos`: the single bit we actually *need* from the file.
r? @petrochenkov
2019-08-01 16:00:29 +02:00
Pietro Albini
810ffe2ba0
Rollup merge of #63122 - Centril:fix-63115, r=petrochenkov
...
Account for `maybe_whole_expr` in range patterns
Fixes https://github.com/rust-lang/rust/issues/63115 (fallout from https://github.com/rust-lang/rust/pull/62550 ).
r? @petrochenkov
2019-08-01 16:00:26 +02:00
Mazdak Farrokhzad
6551285cca
Address review comments.
2019-07-31 21:25:11 +02:00
Aleksey Kladov
3f461f5ec6
cleanup StringReader fields
2019-07-31 20:25:10 +03:00
Mazdak Farrokhzad
758931948f
Unsupport the await!(..) macro.
2019-07-30 10:55:45 +02:00
Mazdak Farrokhzad
36029878e7
Rollup merge of #62928 - Centril:recover-parens-around-for-head, r=estebank
...
Syntax: Recover on `for ( $pat in $expr ) $block`
Fixes #62724 by adding some recovery:
```
error: unexpected closing `)`
--> $DIR/recover-for-loop-parens-around-head.rs:10:23
|
LL | for ( elem in vec ) {
| --------------^
| |
| opening `(`
| help: remove parenthesis in `for` loop: `elem in vec`
```
The last 2 commits are drive-by cleanups.
r? @estebank
2019-07-30 05:37:32 +02:00
Mazdak Farrokhzad
f3a3290ba3
Account for maybe_whole_expr in range patterns.
2019-07-30 04:22:09 +02:00
Mazdak Farrokhzad
a4cd2ecab2
Rollup merge of #61856 - c410-f3r:attrs-fn, r=matthewjasper
...
Lint attributes on function arguments
Fixes #61238 .
cc #60406
2019-07-28 21:19:50 +02:00
Mazdak Farrokhzad
56b39fba56
Add 'span_to_snippet' shortcut.
2019-07-28 20:43:09 +02:00
Mazdak Farrokhzad
1b118607ec
Use chaining for diagnosics in parser.
2019-07-28 20:43:09 +02:00
Mazdak Farrokhzad
dfad725be5
Recover 'for ( $pat in $expr ) $block'.
2019-07-28 20:43:09 +02:00
Mazdak Farrokhzad
75e23ff411
Rollup merge of #62550 - Centril:rest-patterns, r=petrochenkov
...
Implement RFC 2707 + Parser recovery for range patterns
Implement https://github.com/rust-lang/rfcs/pull/2707 .
- Add a new basic syntactic pattern form `ast::PatKind::Rest` (parsed as `..` or `DOTDOT`) and simplify `ast::PatKind::{Slice, Tuple, TupleStruct}` as a result.
- Lower `ast::PatKind::Rest` in combination with the aforementioned `PatKind` variants as well as `PatKind::Ident`. The HIR remains unchanged for now (may be advisable to make slight adjustments later).
- Refactor `parser.rs` wrt. parsing sequences and lists of things in the process.
- Add parser recovery for range patterns of form `X..`, `X..=`, `X...`, `..Y`, `..=Y`, and `...Y`.
This should make it easy to actually support these patterns semantically later if we so desire.
cc https://github.com/rust-lang/rust/issues/62254
r? @petrochenkov
2019-07-28 11:11:04 +02:00
Mazdak Farrokhzad
becdba80ea
Address comments in lowering + parsing.
2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
2f55354759
Recover on 'X..' / 'X..=' / 'X...' range patterns.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
974413fcc5
Recover on '..X' / '..=X' / '...X' range patterns.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
62b29a1e17
Adjust parsing of Slice, Tuple, TupleStruct patterns.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
7e1b671f8a
Cleanup using the new parse_*_seq methods.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
7aeb4b7327
Add more parse_*_seq methods for code reuse.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
0a40ef23ad
Cleanup parse_seq_* methods + record trailing separators.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
5c7008540d
Rollup merge of #63038 - eupn:outer-attribute-diag, r=estebank
...
Make more informative error on outer attribute after inner
Fixes #61218 .
?r @estebank
2019-07-28 03:01:53 +02:00
Evgenii P
fc9bfd68b5
Treat doc comments separately
2019-07-27 18:24:17 +07:00
Vadim Petrochenkov
b5a0e6ea80
syntax_ext: proc_macro_decls -> proc_macro_harness
...
Few other minor renamings for consistency.
Remove one unused dependency from `rustc_passes`.
Fix libsyntax tests.
Fix rebase.
2019-07-27 14:16:16 +03:00
Vadim Petrochenkov
4d535bdf59
Move standard library injection into libsyntax_ext
2019-07-27 13:56:54 +03:00
Caio
53fc7fbc96
Lint attributes on function arguments
2019-07-27 07:16:21 -03:00
Evgenii P
8b3f28cf0f
Make more informative error on outer attr after inner
2019-07-27 16:45:45 +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
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
684497648a
review comments: add FIXME comments and formatting
2019-07-25 12:36:51 -07: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
Esteban Küber
f56c8f6ea4
Fix another case
2019-07-23 11:19:13 -07:00
Mark Rousskov
4cb3586db9
Rollup merge of #62851 - matklad:unescape, r=petrochenkov
...
move unescape module to rustc_lexer
It makes sense to keep the definition of escape sequences closer to the lexer itself, and it is also a bit of code that I would like to share with rust-analyzer.
r? @petrochenkov
2019-07-23 12:51:15 -04: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
Esteban Küber
5b3b6b8d00
Make the parser TokenStream more resilient after mismatched delimiter recovery
2019-07-22 18:29:49 -07:00
Mazdak Farrokhzad
376382aff3
Rollup merge of #62870 - matklad:issue-62863, r=petrochenkov
...
fix lexing of comments with many \r
closes #62863
2019-07-22 15:32:29 +02:00
Aleksey Kladov
647bf96b79
fix lexing of comments with many \r
...
closes #62863
2019-07-22 15:39:06 +03:00
Andrew Dassonville
1520fabd5f
Fix typo in Unicode character name
2019-07-21 07:49:26 -07:00
Aleksey Kladov
e63fe150bf
move unescape module to rustc_lexer
2019-07-21 16:46:11 +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
9dbe2e77b3
review comments
2019-07-19 11:36:55 -07:00
Esteban Küber
f5b285906e
Handle more cases of typos misinterpreted as type ascription
2019-07-19 10:56:37 -07: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
ae2672340c
Rollup merge of #62666 - estebank:preempt-ice, r=eddyb
...
Cancel unemitted diagnostics during error recovery
Follow up to https://github.com/rust-lang/rust/pull/62604 . Use @eddyb's preferred style and catch other case of the same problem.
r? @eddyb
2019-07-16 11:38:52 -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
e452e2929d
Auto merge of #62670 - estebank:extern-fn-with-body, r=petrochenkov
...
Detect `fn` with a body in an `extern` block
Fix #62109 .
2019-07-15 02:13:55 +00: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