Commit Graph

2756 Commits

Author SHA1 Message Date
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
Vadim Petrochenkov eac3846b65 Always use token kinds through token module rather than Token type 2019-06-06 14:01:57 +03:00
Alexander Regueiro 3816958f18 Implemented for function bounds, type bounds, and named existential types. 2019-06-05 21:09:26 +01:00
Alexander Regueiro 35585c499f Aggregation of drive-by cosmetic changes. 2019-06-05 21:09:26 +01:00
bors 2a1d6c83d3 Auto merge of #61484 - nnethercote:avoid-more-hygiene-lookups, r=petrochenkov
Avoid more hygiene lookups

Mostly by combining multiple `HygieneData::with` calls into a single call on hot paths.

r? @petrochenkov
2019-06-05 12:46:15 +00:00
Nicholas Nethercote ab9bbf48db Avoid unnecessary rust_2018 calls.
The commit combines two calls into one by saving the result in a local
variable. The commit also moves the check for `async` later, so that
when a different keyword is present the `rust_2018` call will be avoided
completely.
2019-06-05 07:43:15 +10:00
Pietro Albini 46344122d1 Rollup merge of #61500 - estebank:expregression, r=petrochenkov
Fix regression 61475

Addresses #61475.
2019-06-04 22:39:39 +02:00
Mazdak Farrokhzad 3a06a93f59 Rollup merge of #61413 - davidtwco:async-argument-order-in-a-sane-way, r=eddyb
Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from #61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes #61187 (cc #61192).

r? @eddyb
cc @cramertj
2019-06-04 04:48:11 +02:00
Mazdak Farrokhzad 1563514196 Rollup merge of #61409 - varkor:condition-trait-param-ice, r=oli-obk
Fix an ICE with a const argument in a trait

This goes some way towards fixing https://github.com/rust-lang/rust/issues/61383 (the reduced test case is fixed).
2019-06-04 04:48:08 +02:00
Esteban Küber 288202ec29 Fix regression #61475 2019-06-03 12:06:49 -07:00