about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-09-08Move `describe_as_module` from `rustc_middle::print` to `rustc:middle::query`.Nicholas Nethercote-11/+1
That way it doesn't need to be exported.
2025-08-19Pretty print the name of an future from calling async closureMichael Goulet-3/+13
2025-08-13Rollup merge of #144949 - nnethercote:more-Printer-cleanups, r=davidtwcoGuillaume Gomez-30/+52
More `Printer` cleanups A sequel to rust-lang/rust#144776. r? ```@davidtwco```
2025-08-06Add support for shortening `Instance` and use itEsteban Küber-31/+38
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
2025-08-06Rename some `Printer` methods.Nicholas Nethercote-13/+17
I find these name clearer, and starting them all with `print_` makes things more consistent.
2025-08-06Move `should_truncate` from trait `Printer` to sub-trait `PrettyPrinter`.Nicholas Nethercote-4/+0
It's not used in `Printer`.
2025-08-06Add comments to `Printer`.Nicholas Nethercote-17/+39
These details took me some time to work out.
2025-08-03Remove unused arg from `path_append_impl`.Nicholas Nethercote-7/+1
None of the impls use it.
2025-08-03Rename `Printer` variables.Nicholas Nethercote-19/+19
Currently they are mostly named `cx`, which is a terrible name for a type that impls `Printer`/`PrettyPrinter`, and is easy to confuse with other types like `TyCtxt`. This commit changes them to `p`. A couple of existing `p` variables had to be renamed to make way.
2025-04-07Simplify temp path creation a bitMichael Goulet-1/+1
2025-03-30Encode synthetic by-move coroutine body with a different DefPathDataMichael Goulet-2/+5
2025-01-31Rework "long type names" printing logicEsteban Küber-0/+4
Make it so more type-system types can be printed in a shortened version (like `Predicate`s). Centralize printing the information about the "full type name path". Make the "long type path" for the file where long types are written part of `Diag`, so that it becomes easier to keep track of it, and ensure it will always will be printed out last in the diagnostic by making its addition to the output implicit. Tweak the shortening of types in "expected/found" labels. Remove dead file `note.rs`.
2025-01-06Use a post-monomorphization typing env when mangling components that come ↵Michael Goulet-21/+19
from impls
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-0/+1
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-1/+1
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-02Re-implement a type-size based limitMichael Goulet-1/+31
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-1/+1
generics' attributes
2024-05-10Also debugMichael Goulet-0/+4
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-0/+17
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-1/+1
2024-04-08Actually create ranged int types in the type system.Oli Scherer-1/+1
2024-03-22Make RawPtr take Ty and Mutbl separatelyMichael Goulet-1/+1
2024-02-23compiler: clippy::complexity fixesMatthias Krüger-1/+1
2024-02-06Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closureMichael Goulet-2/+19
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-0/+1
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-1/+1
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-4/+1
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-1/+4
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-1/+1
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`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-10-28Remove needless `allow`sNilstrieb-2/+0
2023-10-21Make `ty::print::Printer` take `&mut self` instead of `self`Nilstrieb-31/+31
This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-10-17Remove `Print::Error`Nilstrieb-7/+0
All printing goes through `fmt::Error` now.
2023-10-17Remove `Printer::Error`Nilstrieb-27/+27
It's always a `fmt::Error` except in some cases where it was `!`, but we're not really winning anything in that case.
2023-10-17Remove `Print::Output`Nilstrieb-10/+5
Now that `Printer` doesn't have subprinters anymore, the output of a printing operation is always the same.
2023-10-17Remove "subprinter" types from `Printer`Nilstrieb-26/+20
These are `Self` in almost all printers except one, which can just store the state as a field instead. This simplifies the printer and allows for further simplifications, for example using `&mut self` instead of passing around the printer.
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-2/+1
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-1/+2
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-20/+23
2023-05-28Make EarlyBinder's inner value private; and fix all of the resulting errorsKyle Matsuda-1/+1
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-2/+5
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-1/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-0/+1
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-1/+1
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2022-12-14Remove TraitRef::newOli Scherer-4/+2