summary refs log tree commit diff
path: root/compiler/rustc_hir_pretty/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2024-03-14Rollup merge of #122487 - GuillaumeGomez:rename-stmtkind-local, r=oli-obkMatthias Krüger-2/+2
Rename `StmtKind::Local` variant into `StmtKind::Let` It comes from this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). Starting point was: > I often end up looking at [ExprKind::Let](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.ExprKind.html#variant.Let) instead of Local because of the name. I think renaming it (both the `ExprKind` variant and the Let struct) to `LetPattern` or LetPat could improve the situation as I'm not sure I'm not the only one encountering this issue. And then it evolved into: > It's already `Expr::Let` instead of `StmtKind::Local`. Counterproposal: rename `StmtKind::Local` to `StmtKind::Let`. The goal here is to clear this confusion. r? `@oli-obk`
2024-03-14Rename `hir::StmtKind::Local` into `hir::StmtKind::Let`Guillaume Gomez-2/+2
2024-03-13Create some minimal HIR for associated opaque typesVadim Petrochenkov-0/+1
2024-02-24Add asm label support to AST and HIRGary Guo-0/+4
2024-02-12Lower anonymous structs or unions to HIRFrank King-16/+21
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-2/+0
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````
2024-02-07hir: Remove `fn opt_hir_id` and `fn opt_span`Vadim Petrochenkov-1/+1
2024-02-07hir: Make sure all `HirId`s have corresponding HIR `Node`sVadim Petrochenkov-0/+7
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-28hir: Use `InferArg` in `ArrayLen::Infer`Vadim Petrochenkov-1/+1
2024-01-17Add `PatKind::Err`Lieselotte-0/+5
2024-01-12Delegation implementation: step 1Bryanskiy-1/+1
2024-01-05Remove `hir::Guard`Matthew Jasper-11/+3
Use Expr instead. Use `ExprKind::Let` to represent if let guards.
2023-12-25Make closures carry their own ClosureKind, rather than deducing what it is ↵Michael Goulet-1/+1
from movability
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-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