Commit Graph

3167 Commits

Author SHA1 Message Date
Vadim Petrochenkov 0ffb6438a6 Make sure #[rustc_doc_only_macro] and other rustc attributes are registered 2019-06-30 12:47:33 +03:00
Igor Matuszewski 12806b7050 Fix clippy::redundant_field_names 2019-06-26 13:59:58 +02:00
bors 85ed21e83c Auto merge of #62070 - ia0:rustfmt, r=petrochenkov
Run rustfmt on some libsyntax files

As part of #62008, run rustfmt on:
- src/libsyntax/ext/tt/macro_rules.rs
- src/libsyntax/ext/tt/quoted.rs

There is no semantic change. To fix potential merge conflicts, simply choose the other side then run rustfmt and fix any tidy check (like line length).
2019-06-23 22:50:56 +00:00
bors 5d677b2efd Auto merge of #60861 - Centril:let-chains-ast-intro, r=petrochenkov
[let_chains, 2/6] Introduce `Let(..)` in AST, remove IfLet + WhileLet and parse let chains

Here we remove `ast::ExprKind::{IfLet, WhileLet}` and introduce `ast::ExprKind::Let`.
Moreover, we also:
+ connect the parsing logic for let chains
+ introduce the feature gate
+ rewire HIR lowering a bit.

However, this does not connect the new syntax to semantics in HIR.
That will be the subject of a subsequent PR.

Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
Next step after https://github.com/rust-lang/rust/pull/59288.

cc @Manishearth re. Clippy.

r? @oli-obk
2019-06-23 12:28:12 +00:00
Julien Cretin 0aeab41e5a Run rustfmt 2019-06-23 11:44:52 +02:00
Mazdak Farrokhzad 74380b3336 Rollup merge of #62068 - ia0:fix_meta_var, r=petrochenkov
Fix meta-variable binding errors in macros

The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.

Found by https://github.com/rust-lang/rust/pull/62008
2019-06-23 01:59:20 +02:00
Mazdak Farrokhzad c75f7ecaee let_chains: note re. back-compat wrt. expr beginning. 2019-06-23 01:41:09 +02:00
Julien Cretin b8106b59d2 Fix meta-variable binding errors in macros
The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.
2019-06-23 01:30:41 +02:00
Mazdak Farrokhzad 92587e41d9 let_chains: readd kw::let to ident_can_begin_expr. 2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad e994d35e9b Lint empty 'derive()' as unused attribute. 2019-06-22 13:19:55 +02:00
Mazdak Farrokhzad 7b3984b21b Rollup merge of #61547 - petrochenkov:cfgen, r=Centril
Support `cfg` and `cfg_attr` on generic parameters

`cfg` attributes are supported in all other positions where attributes are accepted at all.

They were previously prohibited in https://github.com/rust-lang/rust/pull/51283 because they weren't implemented correctly before that and were simply ignored.
2019-06-19 17:34:36 +02:00
Vadim Petrochenkov 0b58bb32f6 Support cfg and cfg_attr on generic parameters 2019-06-19 10:59:15 +03:00
Mazdak Farrokhzad d51002ce07 Rollup merge of #61898 - petrochenkov:sekind, r=eddyb
syntax: Factor out common fields from `SyntaxExtension` variants

And some other related cleanups.

Continuation of https://github.com/rust-lang/rust/pull/61606.
This will also help to unblock https://github.com/rust-lang/rust/pull/61877.
2019-06-19 01:52:10 +02:00
Eduard-Mihai Burtescu b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Vadim Petrochenkov e152554e11 resolve/expand: Move expansion info setting to a single earlier point 2019-06-18 11:01:20 +03:00
Vadim Petrochenkov 2de2278f1a syntax: Move default_transparency into ExpnInfo 2019-06-18 10:48:56 +03:00
Vadim Petrochenkov 8ec502eecd syntax: Introduce default/with_unstable constructors for ExpnInfo 2019-06-18 10:48:56 +03:00
Vadim Petrochenkov 085a8d0375 syntax: Remove DummyResolver 2019-06-18 10:48:56 +03:00
Vadim Petrochenkov 961ba8f9ef syntax: Factor out common fields from SyntaxExtension variants 2019-06-18 10:48:56 +03:00
Mazdak Farrokhzad 2ba1d94f7a Rollup merge of #61866 - sinkuu:redundant_clone, r=petrochenkov
Remove redundant `clone()`s
2019-06-16 06:05:18 +02:00
Mazdak Farrokhzad be09427b11 Rollup merge of #61813 - matthewjasper:remove-unnecessary-symbol-ops, r=petrochenkov
Remove some unnecessary symbol interner ops

* Don't gensym symbols that don't need to worry about colliding with other symbols
* Use symbol constants instead of interning string literals in a few places.
* Don't generate a module in `__register_diagnostic`

r? @petrochenkov
2019-06-15 17:45:02 +02:00
Shotaro Yamada 165842ba1f Use slice::from_ref instead of cloning 2019-06-15 20:46:00 +09:00
Matthew Jasper 4e212c6ddc Avoid some unnecessary symbol interner operations 2019-06-14 18:54:58 +01: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
Vadim Petrochenkov 93eb63c9a5 syntax: Rename variants of SyntaxExtension for consistency 2019-06-10 21:34:26 +03:00
Vadim Petrochenkov 0468eb63ad syntax: Improve documentation of SyntaxExtension 2019-06-10 21:33:33 +03:00
Vadim Petrochenkov 8edbbacbca syntax: Remove SyntaxExtension::DeclMacro
It's a less powerful duplicate of `SyntaxExtension::NormalTT`
2019-06-10 21:33:31 +03:00
Vadim Petrochenkov edb925a91f syntax: Use MultiItemModifier for built-in derives 2019-06-10 21:32:48 +03:00
Vadim Petrochenkov 5a6ebec018 syntax: Remove SyntaxExtension::MultiDecorator and MultiItemDecorator 2019-06-10 21:25:56 +03:00
Vadim Petrochenkov 97f4e700c2 syntax: Remove SyntaxExtension::IdentTT and IdentMacroExpander 2019-06-10 21:19:40 +03:00
Caio 1eaaf440d5 Allow attributes in formal function parameters 2019-06-09 07:58:40 -03:00
Mazdak Farrokhzad 3ba82f7cd8 pacify tidy. 2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad f86719a111 Some more cleanup in libsyntax::ext::tt::quoted 2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad ab7d75d89b Cleanups in parse_sep_and_kleene_op. 2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad 39fbcfb277 Support ? Kleene operator in 2015. 2019-06-09 04:16:33 +02:00
Mazdak Farrokhzad 6b71fba9c1 Rollup merge of #61669 - petrochenkov:tokderef2, r=oli-obk
syntax: Remove `Deref` impl from `Token`

Follow up to https://github.com/rust-lang/rust/pull/61541

r? @oli-obk
2019-06-09 00:20:38 +02:00
Mazdak Farrokhzad 8dea8464f4 Rollup merge of #61646 - L117:master, r=Centril
Remove useless allocations in macro_rules follow logic.

Closes  #61543
2019-06-09 00:20:32 +02: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 ffe23475cb syntax: Keep full Tokens for macro_rules separators 2019-06-08 20:36:20 +03:00
L117 7a74f33f90 Remove useless allocations in macro_rules follow logic. 2019-06-08 09:39:52 +10: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