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
bors
83e4eed16e
Auto merge of #62638 - estebank:issue-62554, r=petrochenkov
...
Use snippet instead of pprinting statement
Fix #62554 .
2019-07-14 17:29:17 +00:00
Mazdak Farrokhzad
4fe6e63cd6
Rollup merge of #62604 - estebank:unemitted-err-ice, r=pnkfelix
...
Handle errors during error recovery gracefully
Fix #62546 .
2019-07-13 16:18:38 +02: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
726aa1437f
Use snippet instead of pprinting statement
2019-07-12 14:01:13 -07:00
Mazdak Farrokhzad
a7f1649fbb
Rollup merge of #62607 - estebank:this-mem-is-out-of-control, r=petrochenkov
...
Correctly break out of recovery loop
Fix #61858 .
2019-07-12 22:46:52 +02:00
Esteban Küber
cc481a46cb
Correctly break out of recovery loop
2019-07-11 20:02:54 -07:00
Esteban Küber
c9f7a3d206
Emit dropped unemitted errors to aid in ICE debugging
2019-07-11 16:59:19 -07:00
Esteban Küber
e1c7747cf0
Handle errors during error recovery gracefully
2019-07-11 16:54:33 -07:00
Mark Rousskov
63fdf1a527
Remove needless indent arguments
...
We're always indenting by INDENT_UNIT anyway
2019-07-10 07:13:22 -04:00
Mark Rousskov
cab453250a
Move pp::Printer helpers to direct impl
2019-07-10 07:13:20 -04:00
Mazdak Farrokhzad
84527e4676
Rollup merge of #62292 - Centril:split-async-closures, r=cramertj
...
Move `async || ...` closures into `#![feature(async_closure)]`
The `async || expr` syntax is moved out from `#![feature(async_await)]` into its own gate `#![feature(async_closure)]`.
New tracking issue: https://github.com/rust-lang/rust/issues/62290
Closes https://github.com/rust-lang/rust/issues/62214 .
cc https://github.com/rust-lang/rust/issues/62149
r? @varkor
2019-07-05 13:53:06 +02:00
bors
f119bf2761
Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
...
Remove io::Result from syntax::print
Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
2019-07-05 06:55:48 +00:00
Mazdak Farrokhzad
8867ba19de
Rollup merge of #62258 - petrochenkov:idclean, r=Centril
...
syntax: Unsupport `foo! bar { ... }` macros in the parser
Their support in expansion was removed in https://github.com/rust-lang/rust/pull/61606 .
Also un-reserve `macro_rules` as a macro name, there's no ambiguity between `macro_rules` definitions and macro calls (it also wasn't reserved correctly).
cc https://github.com/rust-lang-nursery/wg-grammar/issues/51
2019-07-04 01:38:49 +02:00
Mazdak Farrokhzad
bb7fbb99a2
Add separate 'async_closure' feature gate.
2019-07-03 23:59:36 +02:00
Chris Gregory
636f5e6d11
Convert more usages over
2019-07-01 20:21:12 -07:00
Vadim Petrochenkov
d0dc41a2bd
Address review comments
2019-07-01 12:20:54 +03: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
Mazdak Farrokhzad
ce1d95af4c
Always parse 'async unsafe fn' + properly ban in 2015.
2019-06-29 21:38:26 +02:00
Mark Rousskov
da5c835c8b
Remove io::Result from syntax::print
...
Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
2019-06-29 09:10:17 -04:00
Igor Matuszewski
12806b7050
Fix clippy::redundant_field_names
2019-06-26 13:59:58 +02:00
bors
303f77ee1d
Auto merge of #60732 - jswrenn:arbitrary_enum_discriminant, r=pnkfelix
...
Implement arbitrary_enum_discriminant
Implements RFC rust-lang/rfcs#2363 (tracking issue #60553 ).
2019-06-25 15:12:11 +00:00
bors
3cc3486733
Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkov
...
Remove `ast::Guard`
With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861 , the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114 ) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here.
However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...).
r? @petrochenkov
2019-06-24 05:00:10 +00:00
Mazdak Farrokhzad
4d53714183
Remove redundant syntax::ast::Guard.
2019-06-23 11:32:16 +02:00
Mazdak Farrokhzad
851066f57e
let_chains: Fix bugs in pretty printing.
2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad
7465eb44f0
let_chains: Refactor parse_{if,while}_expr a bit.
2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad
eb4f54a58d
let_chains: Move feature gating to pre-expansion.
2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad
3b7f0cb7e0
let_chains: Fix outdated doc-comment re. 'parse_if_expr'.
2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad
dff1e379fc
let_chains: Add support for parsing let expressions.
2019-06-23 01:29:29 +02:00
John Wrenn
ac98342e84
Implement arbitrary_enum_discriminant
2019-06-21 11:00:10 -04:00
Matthew Jasper
63edd2c358
Remove the HirId/NodeId from where clauses
...
Also give them a span in the HIR
2019-06-18 22:54:51 +01:00
bors
55cee44671
Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=petrochenkov
...
Special-case literals in `parse_bottom_expr`.
This makes parsing faster, particularly for code with large constants,
for two reasons:
- it skips all the keyword comparisons for literals;
- it skips the allocation done by the `mk_expr` call in
`parse_literal_maybe_minus`.
r? @petrochenkov
2019-06-12 16:30:05 +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
Nicholas Nethercote
35b5f43770
Special-case literals in parse_bottom_expr.
...
This makes parsing faster, particularly for code with large constants,
for two reasons:
- it skips all the keyword comparisons for literals;
- it replaces the unnecessary `parse_literal_maybe_minus` call with
`parse_lit`, avoiding an unnecessary allocation via `mk_expr`.
2019-06-10 10:04:25 +10:00
Caio
1eaaf440d5
Allow attributes in formal function parameters
2019-06-09 07:58:40 -03:00
Vadim Petrochenkov
25b05147b3
syntax: Remove Deref impl from Token
2019-06-08 22:38:23 +03:00
Vadim Petrochenkov
0ca3c2f881
syntax: Move most of the TokenKind methods to Token
2019-06-08 22:38:12 +03:00
Vadim Petrochenkov
3dbee57dae
parser: Remove look_ahead_span
2019-06-07 13:57:57 +03:00
Vadim Petrochenkov
6eae6b0fe9
parser: Remove Deref impl from Parser
2019-06-07 13:52:03 +03:00
Vadim Petrochenkov
3da094319c
parser: self.span -> self.token.span
2019-06-07 13:51:23 +03:00
Vadim Petrochenkov
3a31f0634b
Address review comments
2019-06-06 14:04:33 +03:00
Vadim Petrochenkov
ff40e37b98
Some code cleanup and tidy/test fixes
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
67ce3f4589
syntax: Switch function parameter order in TokenTree::token
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
f745e5f9b6
syntax: Remove duplicate span from token::Ident
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
4c5d773b4d
syntax: Remove duplicate span from token::Lifetime
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
5e693531ff
syntax: Add some helper methods to Token
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
aa6fba98ae
syntax: Use Token in Parser
2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
e0127dbf81
syntax: Use Token in TokenTree::Token
2019-06-06 14:03:15 +03:00
Vadim Petrochenkov
a3425edb46
syntax: Rename TokenAndSpan into Token
2019-06-06 14:03:15 +03:00
Vadim Petrochenkov
99b27d749c
syntax: Rename Token into TokenKind
2019-06-06 14:03:14 +03:00