about summary refs log tree commit diff
path: root/compiler/rustc_hir_pretty/src
AgeCommit message (Collapse)AuthorLines
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-2/+2
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-8/+9
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-16Auto merge of #123468 - compiler-errors:precise-capturing, r=oli-obkbors-0/+1
Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`) Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to #117587. We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list. We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future. We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future. r? `@oli-obk` Tracking issue: - https://github.com/rust-lang/rust/issues/123432
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-8/+9
Because they're a bit redundant.
2024-04-15Fix pretty hir for anon consts in diagnosticsMichael Goulet-10/+6
2024-04-15Add hir::Node::PreciseCapturingNonLifetimeArgMichael Goulet-0/+1
2024-04-11Remove `bin_op_to_assoc_op` and invoke `AssocOp::from_ast_binop` directlyOli Scherer-28/+1
2024-04-08Thread pattern types through the HIROli Scherer-0/+5
2024-03-27Implement `mut ref`/`mut ref mut`Jules Bertholet-3/+6
2024-03-22Rename `hir::Node::Local` into `hir::Node::LetStmt`Guillaume Gomez-1/+1
2024-03-22Rename `hir::Local` into `hir::LetStmt`Guillaume Gomez-1/+1
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-0/+6
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
2024-03-20Rename `hir::Let` into `hir::LetExpr`Guillaume Gomez-1/+1
2024-03-19The AssocOpaqueTy HIR node is not actually needed to differentiate from ↵Oli Scherer-1/+1
other hir nodes that were fed
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`