Vadim Petrochenkov
a6182711ef
Remove Spanned from {ast,hir}::FieldPat
2019-08-15 12:31:50 +03:00
Vadim Petrochenkov
433b1e36e1
Remove Spanned from ast::Mac
2019-08-15 11:45:28 +03:00
Caio
6a42b0b28d
Merge Variant and Variant_
2019-08-14 14:47:01 -03:00
Mazdak Farrokhzad
b2603d6386
Rollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkov
...
Some more libsyntax::attr cleanup
Much smaller patch than the last one, mostly just finishing up by removing some Span arguments.
r? @petrochenkov
2019-08-06 08:17:42 +02:00
Mark Rousskov
ab3fb1e775
Drop span argument from mk_list_item
2019-08-05 08:45:00 -04:00
Aleksey Kladov
58ac81a60f
add unknown token
2019-08-05 13:15:11 +03: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
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
f6d8977fbb
Rollup merge of #63212 - Centril:param-attrs-pretty, r=davidtwco
...
Pretty print attributes in `print_arg`
Fixes https://github.com/rust-lang/rust/issues/63210 .
cc https://github.com/rust-lang/rust/issues/60406
r? @petrochenkov
2019-08-03 00:09:12 +02:00
Mazdak Farrokhzad
dd98727541
Print outer attributes on formal params.
2019-08-02 09:34:49 +02:00
Mazdak Farrokhzad
875cef0324
Cleanup 'print_generic_params'.
2019-08-02 08:36:08 +02:00
varkor
c28ce3e4ca
Replace "existential" by "opaque"
2019-08-02 02:44:36 +01:00
Vadim Petrochenkov
62ec2cb7ac
Remove some more cfg(test)s
2019-08-02 02:40:01 +03:00
Vadim Petrochenkov
310b9fc760
libsyntax: Unconfigure tests during normal build
2019-08-02 01:59:01 +03:00
Mark Rousskov
f78bf50dec
Remove span argument from mk_attr_{inner,outer}
...
Always the same as the passed MetaItem
2019-07-31 08:55:37 -04:00
Mark Rousskov
0a42badd4c
Remove AttrId from Attribute constructors
2019-07-31 08:55:37 -04:00
Mazdak Farrokhzad
758931948f
Unsupport the await!(..) macro.
2019-07-30 10:55:45 +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
b02941f2a6
Adjust pretty printing accordingly.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
f7c75cc11a
Add 'ast::PatKind::Rest'.
2019-07-28 06:53:38 +02:00
Vadim Petrochenkov
4d535bdf59
Move standard library injection into libsyntax_ext
2019-07-27 13:56:54 +03:00
Vadim Petrochenkov
0cdd18d0a7
pprust: Support macro macros
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
a2a1cd1864
pprust: Fix formatting regressions from the previous commits
...
Fix some remaining cases of bad formatting
Update some failing tests
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
75896011dc
pprust: Do not convert attributes into MetaItems for printing
...
Fixes https://github.com/rust-lang/rust/issues/62628
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
160c40bc88
pprust: Remove the box from print_tts
...
Wrap the whole attribute into a box instead
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
11585b598c
pprust: Use print_mac_common for delimited token groups
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
23c5c1bfe7
pprust: Use print_mac_common for attributes
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
500b00127b
pprust: Use print_mac_common for macro_rules definitions
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
65a714a6a0
pprust: Move some methods to the PrintState trait
...
So that path and macro argument printing code can be shared
2019-07-15 12:42:07 +03:00
Esteban Küber
726aa1437f
Use snippet instead of pprinting statement
2019-07-12 14:01:13 -07:00
Vadim Petrochenkov
e38106599a
Address review comments
2019-07-11 12:34:57 +03:00
Vadim Petrochenkov
af26e7f4f4
pretty-print: Merge print_tts and print_tts_ext
2019-07-11 12:08:29 +03:00
Vadim Petrochenkov
da50d59881
pretty-print: Do not lose the $crate printing flag in print_tt
2019-07-11 12:07:35 +03:00
Mark Rousskov
56a9237b59
File is now short enough for tidy
2019-07-10 07:13:59 -04:00
Mark Rousskov
096cb4137d
Remove writer function from PrintState
2019-07-10 07:13:57 -04:00
Mark Rousskov
73c1752b8e
Use constant instead of magic number
2019-07-10 07:13:22 -04: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
Mark Rousskov
e91dbc5916
Rename is_bol -> is_beginning_of_line
...
Also moves it to pp::Printer from PrintState.
2019-07-10 07:12:29 -04:00
Mark Rousskov
39aa9bf730
Remove needless indirection in bclose
2019-07-10 07:12:29 -04:00
Mark Rousskov
04b80a5f5d
Drop length from Token::String
...
It was always set to the string's length
2019-07-10 07:12:29 -04:00
Mark Rousskov
4783d9eaa5
Remove is_begin/is_end functions from PrintState
...
These are somewhat ambiguous (beginning/end of what?) so it's better to
inline their one use into the code.
2019-07-10 07:12:29 -04:00
Mark Rousskov
00ca508608
Move pp::Printer out field to owned String
...
This enforces that eof() must be called to get the String out, and
generally is better from an API perspective. No users of pretty printing
pre-allocate the buffer.
2019-07-10 07:12:28 -04:00
Mark Rousskov
e0ffa7c3d2
Inline State::new_from_input in pprust
...
This function took too many arguments and are simple on the inside;
inlining them makes complexity go down.
hir::print's copy is unfortunately used from librustc_driver so inlining
it is not as straightforward.
2019-07-10 07:12:28 -04:00
Mark Rousskov
e0db2e606c
print_crate returns String instead of taking an out pointer
2019-07-10 07:12:28 -04:00
Mark Rousskov
7e3791469f
Replace src: &mut dyn Read with String
2019-07-10 07:12:28 -04:00
Mark Rousskov
0eb2e566c1
Combine comment-handling logic into struct
...
This also permits sharing the underlying code between pprust and
hir::print.
2019-07-10 07:12:28 -04:00
Mark Rousskov
9b5e39723d
Inline State::new
...
There was only one callsite for each and this removes the
unwrap_or_default's on the comments argument
2019-07-10 07:12:28 -04:00