about summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2019-09-27Filter out stmts made for the redundant_semicolon lint when pretty-printingnathanwhit-3/+12
2019-09-26Rename `MetaItem.node` to `MetaItem.kind`varkor-1/+1
2019-09-26Rename `ForeignItem.node` to `ForeignItem.kind`varkor-1/+1
2019-09-26Rename `Item.node` to `Item.kind`varkor-1/+1
2019-09-26Rename `Stmt.node` to `Stmt.kind`varkor-2/+2
2019-09-26Rename `Ty.node` to `Ty.kind`varkor-2/+2
2019-09-26Rename `TraitItem.node` to `TraitItem.kind`varkor-1/+1
2019-09-26Rename `ImplItem.node` to `ImplItem.kind`varkor-1/+1
2019-09-26Rename `Pat.node` to `Pat.kind`varkor-2/+2
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-30/+27
For both `ast::Expr` and `hir::Expr`.
2019-09-17Print syntax contexts and marks when printing hygiene informationMatthew Jasper-0/+2
2019-09-15Print visibility of `macro` itemsMatthew Jasper-2/+6
2019-09-09Resolve attributes in several placesCaio-0/+1
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-30/+27
2019-09-07Rollup merge of #63919 - matthewjasper:remove-gensymmed, r=petrochenkovMazdak Farrokhzad-4/+8
Use hygiene for AST passes AST passes are now able to have resolve consider their expansions as if they were opaque macros defined either in some module in the current crate, or a fake empty module with `#[no_implicit_prelude]`. * Add an ExpnKind for AST passes. * Remove gensyms in AST passes. * Remove gensyms in`#[test]`, `#[bench]` and `#[test_case]`. * Allow opaque macros to define tests. * Move tests for unit tests to their own directory. * Remove `Ident::{gensym, is_gensymed}` - `Ident::gensym_if_underscore` still exists. cc #60869, #61019 r? @petrochenkov
2019-09-06Rollup merge of #64111 - Centril:ast-only-patkind-or, r=petrochenkovMazdak Farrokhzad-13/+8
or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve Following up on work in https://github.com/rust-lang/rust/pull/63693 and https://github.com/rust-lang/rust/pull/61708, in this PR we: - Uniformly use `PatKind::Or(...)` in AST: - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>` - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>` - Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result. In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed: ```rust enum E<T> { A(T, T), B(T) } use E::*; fn foo() { match A(0, 1) { B(mut a) | A(mut a, mut a) => {} } } ``` The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct. - Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline. - Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff). cc https://github.com/rust-lang/rust/issues/54883 cc @dlrobertson @matthewjasper r? @petrochenkov
2019-09-05Fix 2018 edition expanded pretty printingMatthew Jasper-4/+8
2019-09-05or-patterns: syntax: adjust pretty printing.Mazdak Farrokhzad-13/+8
2019-09-03use TokenStream rather than &[TokenTree] for built-in macrosAleksey Kladov-5/+1
That way, we don't loose the jointness info
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-9/+9
2019-08-25pprust: Do not print spaces before some tokensVadim Petrochenkov-1/+13
2019-08-17initial implementation of or-pattern parsingDan Robertson-35/+12
Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`. This is a partial implementation of RFC 2535.
2019-08-17Initial implementation of or patternsvarkor-2/+31
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-3/+3
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15Remove `Spanned` from `{ast,hir}::FieldPat`Vadim Petrochenkov-4/+4
2019-08-15Remove `Spanned` from `ast::Mac`Vadim Petrochenkov-7/+7
2019-08-14Merge Variant and Variant_Caio-5/+6
2019-08-06Rollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkovMazdak Farrokhzad-3/+2
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-05Drop span argument from mk_list_itemMark Rousskov-3/+2
2019-08-05add unknown tokenAleksey Kladov-0/+1
2019-08-04Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias`varkor-1/+1
2019-08-04Rename `ItemKind::Ty` to `ItemKind::TyAlias`varkor-1/+1
2019-08-03Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkovMazdak Farrokhzad-2/+2
Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
2019-08-03Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centrilbors-5/+9
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-03Rollup merge of #63212 - Centril:param-attrs-pretty, r=davidtwcoMazdak Farrokhzad-10/+9
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-02Print outer attributes on formal params.Mazdak Farrokhzad-0/+3
2019-08-02Cleanup 'print_generic_params'.Mazdak Farrokhzad-10/+6
2019-08-02Replace "existential" by "opaque"varkor-5/+9
2019-08-02Remove some more `cfg(test)`sVadim Petrochenkov-20/+16
2019-08-02libsyntax: Unconfigure tests during normal buildVadim Petrochenkov-57/+56
2019-07-31Remove span argument from mk_attr_{inner,outer}Mark Rousskov-2/+2
Always the same as the passed MetaItem
2019-07-31Remove AttrId from Attribute constructorsMark Rousskov-2/+2
2019-07-30Unsupport the await!(..) macro.Mazdak Farrokhzad-11/+3
2019-07-28Rollup merge of #62550 - Centril:rest-patterns, r=petrochenkovMazdak Farrokhzad-47/+9
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-28Adjust pretty printing accordingly.Mazdak Farrokhzad-47/+8
2019-07-28Add 'ast::PatKind::Rest'.Mazdak Farrokhzad-0/+1
2019-07-27Move standard library injection into libsyntax_extVadim Petrochenkov-2/+1
2019-07-15pprust: Support `macro` macrosVadim Petrochenkov-8/+23
2019-07-15pprust: Fix formatting regressions from the previous commitsVadim Petrochenkov-10/+13
Fix some remaining cases of bad formatting Update some failing tests
2019-07-15pprust: Do not convert attributes into `MetaItem`s for printingVadim Petrochenkov-15/+11
Fixes https://github.com/rust-lang/rust/issues/62628