about summary refs log tree commit diff
path: root/compiler/rustc_hir_pretty
AgeCommit message (Collapse)AuthorLines
2023-12-22Rid the AST & HIR pretty printers of syntactic cruftLeón Orell Valerian Liehr-22/+2
2023-12-20Give `VariantData::Struct` named fields, to clairfy `recovered`.Alona Enraght-Moony-1/+1
2023-12-15Rollup merge of #118396 - compiler-errors:ast-lang-items, r=cjgillotJubilee-5/+0
Collect lang items from AST, get rid of `GenericBound::LangItemTrait` r? `@cjgillot` cc #115178 Looking forward, the work to remove `QPath::LangItem` will also be significantly more difficult, but I plan on doing it as well. Specifically, we have to change: 1. A lot of `rustc_ast_lowering` for things like expr `..` 2. A lot of astconv, since we actually instantiate lang and non-lang paths quite differently. 3. A ton of diagnostics and clippy lints that are special-cased via `QPath::LangItem` Meanwhile, it was pretty easy to remove `GenericBound::LangItemTrait`, so I just did that here.
2023-12-15banish hir::GenericBound::LangItemTraitMichael Goulet-5/+0
2023-12-15Annotate some bugsMichael Goulet-17/+11
2023-12-10remove redundant importssurechen-1/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-05Remove `#[rustc_host]`, use internal desugaringDeadbeef-1/+1
2023-11-29Add `never_patterns` feature gateNadrieril-0/+1
2023-11-25Remove HirId from QPath::LangItemMichael Goulet-1/+1
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-8/+10
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Add some comments.Nicholas Nethercote-0/+3
2023-11-22Factor out common code in `PrintState`.Nicholas Nethercote-4/+3
The AST and HIR versions of `State::print_ident` are textually identical, but the types differ slightly. This commit factors out the common code they both have by replacing `print_ident` with `ann_post`, which is a smaller function that still captures the type difference.
2023-11-22Remove `NO_ANN`.Nicholas Nethercote-4/+4
This makes `rustc_hir_pretty` more like `rustc_ast_pretty`.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-19/+19
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-04Fix remaining uses of `CaptureBy::Value`Dinu Blanovschi-1/+1
2023-10-30Rollup merge of #117068 - nnethercote:clean-up-Cargo-toml, r=wesleywiserGuillaume Gomez-4/+4
Clean up `compiler/rustc*/Cargo.toml` Mostly by sorting dependencies, plus some other minor things. r? ``@wesleywiser``
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-4/+4
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-25Print variadic argument pattern in HIR pretty printerDaniPopes-7/+12
2023-10-11Fiddle with `State` functions.Nicholas Nethercote-22/+10
Remove and inline `new_from_input`, because it has a single call site. And move `attrs` into the earlier `impl` block.
2023-10-11Tweak comments.Nicholas Nethercote-4/+2
- Remove an out-of-date comment. (There is no `PpAnn` implementation for `hir::Crate`.) - Remove a low-value comment. - And break a very long comment.
2023-10-11Remove many unneeded `pub`s.Nicholas Nethercote-58/+59
2023-10-10Rejig some top-level `rustc_hir_pretty` functions.Nicholas Nethercote-35/+3
There are several that are unused and can be removed. And there are some calls to `to_string`, which can be expressed more nicely as a `foo_to_string` call, and then `to_string` need not be `pub`. (This requires adding `pat_to_string`).
2023-09-21Record asyncness span in HIRMichael Goulet-1/+1
2023-08-08Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obkbors-5/+0
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
2023-08-06lower impl const to bind to host effect paramDeadbeef-5/+0
2023-08-04Improve spans for indexing expressionsNilstrieb-2/+2
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-4/+8
2023-06-26`hir`: Add `Become` expression kindMaybe Waffle-0/+5
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-3/+4
2023-05-01Rip it outNilstrieb-3/+9
My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
2023-04-21minor tweaksDrMeepster-7/+6
2023-04-21offset_ofDrMeepster-0/+18
2023-04-09Remove identity castsNilstrieb-1/+1
2023-03-28Add `(..)` syntax for RTNMichael Goulet-48/+52
2023-03-14Remove box expressions from HIRclubby789-4/+0
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-2/+2
2023-02-25Add ErrorGuaranteed to HIR ExprKind::ErrMichael Goulet-1/+1
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-1/+1
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-4/+2
2023-01-12parse const closuresDeadbeef-4/+10
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-4/+4
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-15more clippy::complexity fixesMatthias Krüger-1/+0
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-1/+1
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-06Remove outdated syntax from trait alias pretty printingMaybe Waffle-12/+1
2022-12-05Remove `LitKind::synthesize_token_lit`.Nicholas Nethercote-1/+1
It has a single call site in the HIR pretty printer, where the resulting token lit is immediately converted to a string. This commit replaces `LitKind::synthesize_token_lit` with a `Display` impl for `LitKind`, which can be used by the HIR pretty printer.
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-0/+1
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-02Rename `LitKind::to_token_lit` as `LitKind::synthesize_token_lit`.Nicholas Nethercote-1/+1
This makes it clearer that it's not a lossless conversion, which I find helpful.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-1/+1
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-0/+1