about summary refs log tree commit diff
path: root/compiler/rustc_ast_pretty
AgeCommit message (Collapse)AuthorLines
2021-09-20Migrate to 2021Mark Rousskov-1/+1
2021-09-09Revert "Implement Anonymous{Struct, Union} in the AST"Felix S. Klock II-8/+0
This reverts commit 059b68dd677808e14e560802d235ad40beeba71e. Note that this was manually adjusted to retain some of the refactoring introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could likewise retain the correction introduced in commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151
2021-09-09Revert "Fix ast expanded printing for anonymous types"Felix S. Klock II-6/+10
This reverts commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151.
2021-08-30Add let-else to ASTCameron Steffen-2/+8
2021-08-29Auto merge of #88262 - klensy:pprust-cow, r=nagisabors-48/+50
Cow'ify some pprust methods Reduce number of potential needless de/allocations by using `Cow<'static, str>` instead of explicit `String` type.
2021-08-28Treat macros as HIR itemsinquisitivecrystal-18/+30
2021-08-25Convert some functions to return Cow<'static,str> instead of String to ↵klensy-48/+50
reduce potential reallocations
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-17/+10
2021-08-12Add support for clobber_abi to asm!Amanieu d'Antras-0/+10
2021-08-02Auto merge of #87535 - lf-:authors, r=Mark-Simulacrumbors-1/+0
rfc3052 followup: Remove authors field from Cargo manifests Since RFC 3052 soft deprecated the authors field, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information for contributors, we may as well remove it from crates in this repo.
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
2021-07-25use vec![] macro to create Vector with first item inside instead of pushing ↵Matthias Krüger-2/+1
to an empty vec![] slightly reduces code bloat
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-3/+3
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-3/+3
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-06-29Rollup merge of #86358 - klensy:pp-loop, r=Mark-SimulacrumYuki Okushi-1/+0
fix pretty print for `loop`
2021-06-25Auto merge of #86599 - Amanieu:asm_raw, r=nagisabors-0/+3
Add a "raw" option for asm! which ignores format string specifiers This is useful when including raw assembly snippets using `include_str!`.
2021-06-24Add a "raw" option for asm! which ignores format string specifiersAmanieu d'Antras-0/+3
2021-06-23fix pretty print for `loop` in mir and hirklensy-1/+0
2021-06-22Auto merge of #85193 - pnkfelix:readd-support-for-inner-attrs-within-match, ↵bors-0/+5
r=nikomatsakis Re-add support for parsing (and pretty-printing) inner-attributes in match body Re-add support for parsing (and pretty-printing) inner-attributes within body of a `match`. In other words, we can do `match EXPR { #![inner_attr] ARM_1 ARM_2 ... }` again. I believe this unbreaks the only four crates that crater flagged as broken by PR #83312. (I am putting this up so that the lang-team can check it out and decide whether it changes their mind about what to do regarding PR #83312.)
2021-06-17Use `AttrVec` for `Arm`, `FieldDef`, and `Variant`Yuki Okushi-1/+1
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-6/+19
position.
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-24Fix ast expanded printing for anonymous typesjedel1043-10/+6
2021-05-16Implement Anonymous{Struct, Union} in the ASTjedel1043-17/+33
Add unnamed_fields feature gate and gate unnamed fields on parsing
2021-05-15Remove some unncessary spaces from pretty-printed tokenstream outputAaron Hill-1/+4
In addition to making the output look nicer for all crates, this also aligns the pretty-printing output with what the `rental` crate expects. This will allow us to eventually disable a backwards-compat hack in a follow-up PR.
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-112/+113
On x86, the default syntax is also switched to Intel to match asm!
2021-05-11Re-add support for parsing (and pretty-printing) inner-attributes within ↵Felix S. Klock II-0/+5
body of a `match`. In other words, we can do `match EXPR { #![inner_attr] ARM_1 ARM_2 ... }` again. I believe this unbreaks the only four crates that crater flagged as broken by PR 83312. (I am putting this up so that the lang-team can check it out and decide whether it changes their mind about what to do regarding PR 83312.)
2021-05-03parser: Remove support for inner attributes on non-block expressionsVadim Petrochenkov-26/+9
2021-04-06Use AnonConst for asm! constantsAmanieu d'Antras-2/+2
2021-03-27Remove (lots of) dead codeJoshua Nelson-28/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-23Update with commentskadmin-1/+0
2021-03-23Update with commentskadmin-3/+2
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23Some refactoringvarkor-0/+1
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-0/+3
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-19stabilize or_patternsmark-1/+1
2021-03-16ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`Vadim Petrochenkov-2/+2
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-1/+1
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-02-19Rollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011Dylan DPC-28/+25
ast: Keep expansion status for out-of-line module items I.e. whether a module `mod foo;` is already loaded from a file or not. This is a pre-requisite to correctly treating inner attributes on such modules (https://github.com/rust-lang/rust/issues/81661). With this change AST structures for `mod` items diverge even more for AST structure for the crate root, which previously used `ast::Mod`. Therefore this PR removes `ast::Mod` from `ast::Crate` in the first commit, these two things are sufficiently different from each other, at least at syntactic level. Customization points for visiting a "`mod` item or crate root" were also removed from AST visitors (`fn visit_mod`). `ast::Mod` itself was refactored away in the second commit in favor of `ItemKind::Mod(Unsafe, ModKind)`.
2021-02-18Rollup merge of #82066 - matthewjasper:trait-ref-fix, r=jackh726Dylan DPC-0/+1
Ensure valid TraitRefs are created for GATs This fixes `ProjectionTy::trait_ref` to use the correct substs. Places that need all of the substs have been updated to not use `trait_ref`. r? ````@jackh726````
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-22/+20
Also remove `ast::Mod` which is mostly redundant now
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-9/+8
Crate root is sufficiently different from `mod` items, at least at syntactic level. Also remove customization point for "`mod` item or crate root" from AST visitors.
2021-02-16avoid full-slicing slicesMatthias Krüger-3/+3
If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-13Fix pretty printing of generic associated type constraintsMatthew Jasper-0/+1
2021-02-08Fix pretty printer macro_rules with semicolon.Eric Huss-0/+3
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-9/+16
2021-01-23Remove unused dependencybjorn3-1/+0
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-2/+3
2021-01-08rustc_ast_pretty: Remove `PrintState::insert_extra_parens`Vadim Petrochenkov-31/+2
It's no longer necessary after #79472
2021-01-01const_generics_defaults: don't use todoRémy Rakic-1/+0
So that at least it won't ICE for users whether or not they enable the gate. For developers the FIXMEs are enough.
2021-01-01first pass at default values for const genericsJulian Knodt-2/+6
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate