bors
bbd48e6f16
Auto merge of #63127 - kper:pr, r=nikomatsakis
...
Cleanup: Consistently use `Param` instead of `Arg` #62426
Fixes #62426
2019-08-28 03:42:00 +00:00
Kevin Per
e0ce9f8c0a
Cleanup: Consistently use Param instead of Arg #62426
2019-08-27 14:07:41 +02:00
Mazdak Farrokhzad
0da7098116
Rollup merge of #63761 - petrochenkov:procattrs, r=eddyb
...
Propagate spans and attributes from proc macro definitions
Thanks to https://github.com/rust-lang/rust/pull/63269 we now have spans and attributes from proc macro definitions available in metadata.
However, that PR didn't actually put them into use! This PR finishes that work.
Attributes `rustc_macro_transparency`, `allow_internal_unstable`, `allow_internal_unsafe`, `local_inner_macros`, `rustc_builtin_macro`, `stable`, `unstable`, `rustc_deprecated`, `deprecated` now have effect when applied to proc macro definition functions.
From those attributes only `deprecated` is both stable and supposed to be used in new code.
(`#![staged_api]` still cannot be used in proc macro crates for unrelated reasons though.)
`Span::def_site` from the proc macro API now returns the correct location of the proc macro definition.
Also, I made a mistake in https://github.com/rust-lang/rust/pull/63269#discussion_r312702919 , loaded proc macros didn't actually use the resolver cache.
This PR fixes the caching issue, now proc macros go through the `Resolver::macro_map` cache as well.
(Also, the first commit turns `proc_macro::quote` into a regular built-in macro to reduce the number of places where `SyntaxExtension`s need to be manually created.)
2019-08-27 08:17:51 +02:00
Vadim Petrochenkov
c476b55e52
proc_macro: Update Span::def_site to use the proc macro definition location
...
Which is no longer dummy and is available from metadata now.
2019-08-27 01:34:10 +03:00
Mazdak Farrokhzad
1caaa40768
parser: gracefully handle fn foo(A | B: type).
2019-08-25 05:45:19 +02:00
Mazdak Farrokhzad
5f6bec8ecf
parser: drive-by: simplify parse_arg_general.
2019-08-24 21:53:55 +02:00
Vadim Petrochenkov
73dee258c1
hygiene: Remove Options from functions returning ExpnInfo
...
The expansion info is not optional and should always exist
2019-08-15 20:39:27 +03:00
Vadim Petrochenkov
dfcbe75900
syntax_pos: Introduce a helper for checking whether a span comes from expansion
2019-08-15 20:38:12 +03:00
Eduard-Mihai Burtescu
34dcca20e5
syntax: account for CVarArgs being in the argument list.
2019-08-12 15:28:10 +03:00
Mazdak Farrokhzad
bcfcbfc923
parser: {check,expect}_lifetime into ty.rs
2019-08-11 20:46:34 +02:00
Mazdak Farrokhzad
385d07f359
parser: move into generics.rs
2019-08-11 20:44:09 +02:00
Mazdak Farrokhzad
d6d93b3d82
parser: move into stmt.rs
2019-08-11 20:32:29 +02:00
Mazdak Farrokhzad
28db7c5968
parser: move parse_fn_block_decl into expr.rs
2019-08-11 20:04:09 +02:00
Mazdak Farrokhzad
848ec4aa3c
parser: move parse_ident_or_underscore into item.rs
2019-08-11 20:00:38 +02:00
Mazdak Farrokhzad
3dbfbafe3e
parser: split into {ty, path}.rs
2019-08-11 19:59:27 +02:00
Mazdak Farrokhzad
e81347c368
parser: split into {item,module}.rs
2019-08-11 18:34:42 +02:00
Mazdak Farrokhzad
e742de2569
parser: split into pat.rs
2019-08-11 15:24:37 +02:00
Mazdak Farrokhzad
81e6b5094e
parser: split into expr.rs
2019-08-11 13:14:30 +02:00
Esteban Küber
b7f7756566
Recover parser from foo(_, _)
2019-08-09 07:18:05 -07:00
bors
d3f8a0b5df
Auto merge of #63213 - varkor:itemkind-tyalias, r=Centril
...
Rename `ItemKind::Ty` to `ItemKind::TyAlias`
The current name is not entirely clear without context and `TyAlias` is consistent with `ItemKind::TraitAlias`.
2019-08-04 20:03:28 +00:00
varkor
63659ca9f6
Rename ItemImplKind::Type to ItemImplKind::TyAlias
2019-08-04 20:16:41 +01:00
varkor
8aa45c65d8
Rename ItemKind::Ty to ItemKind::TyAlias
2019-08-04 20:13:37 +01:00
bors
f01b9f803b
Auto merge of #62816 - estebank:type-ascription-macros, r=petrochenkov
...
Point at type ascription before macro invocation on expansion parse error
Fix https://github.com/rust-lang/rust/issues/47666 . Follow up to https://github.com/rust-lang/rust/pull/62791 .
r? @petrochenkov
2019-08-04 16:19:04 +00:00
Mazdak Farrokhzad
15b5aacab6
Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkov
...
Cleanup syntax::attr
Mostly removing needless arguments to constructors
r? @petrochenkov
2019-08-03 13:11:59 +02:00
bors
d7270712cb
Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centril
...
Change opaque type syntax from `existential type` to type alias `impl Trait`
This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature.
The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC.
This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063 .
r? @Centril
2019-08-03 02:21:23 +00:00
Mazdak Farrokhzad
3396550420
Rollup merge of #63202 - exphp-forks:parser-ice-63135, r=estebank
...
Fix ICE in #63135
Closes #63135 .
r?@estebank
2019-08-02 12:14:21 +02:00
varkor
c28ce3e4ca
Replace "existential" by "opaque"
2019-08-02 02:44:36 +01:00
varkor
87738fe834
Switch existential_type to type_alias_impl_trait
2019-08-02 02:44:35 +01:00
Michael Lamparski
b3321fb26e
Fix ICE in #63135
2019-08-01 17:34:00 -04: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
Mark Rousskov
c9bd4a05bf
Replace a few Attribute constructors with mk_attr
2019-07-31 08:55:37 -04:00
Esteban Küber
c82e1f2d0e
Point at type ascription before macro invocation on expansion parse error
2019-07-30 09:16:27 -07: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
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
Caio
53fc7fbc96
Lint attributes on function arguments
2019-07-27 07:16:21 -03: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
fe2b5bbe6d
review comments
2019-07-23 12:51:34 -07:00