about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/structural_impls.rs
AgeCommit message (Collapse)AuthorLines
2025-09-26predefined opaques use `List`lcnr-0/+1
2025-09-17Remove `DynKind`León Orell Valerian Liehr-8/+6
2025-08-14pattern testing: store constants as valtreesRalf Jung-9/+4
2025-08-03Rename `Printer` variables.Nicholas Nethercote-7/+7
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-07-31Streamline const folding/visiting.Nicholas Nethercote-26/+20
Type folders can only modify a few "types of interest": `Binder`, `Ty`, `Predicate`, `Clauses`, `Region`, `Const`. Likewise for type visitors, but they can also visit errors (via `ErrorGuaranteed`). Currently the impls of `try_super_fold_with`, `super_fold_with`, and `super_visit_with` do more than they need to -- they fold/visit values that cannot contain any types of interest. This commit removes those unnecessary fold/visit operations, which makes these impls more similar to the impls for `Ty`. It also removes the now-unnecessary derived impls for the no-longer-visited types.
2025-07-23Remove useless lifetime parameter.Camille GILLOT-1/+2
2025-07-23Give an AllocId to ConstValue::Slice.Camille GILLOT-0/+8
2025-07-15Add alias for ArgOutlivesPredicateMichael Goulet-1/+1
2025-07-15Add outlives to CoroutineWitnessTypesMichael Goulet-0/+1
2025-07-04Fix pretty printing of placeholder typesMichael Goulet-1/+1
2025-07-04Same for typesMichael Goulet-1/+1
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-12/+10
2025-06-25make `tidy-alphabetical` use a natural sortFolkert de Vries-6/+6
2025-05-29Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errorsbors-1/+26
add additional `TypeFlags` fast paths Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial. This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s. Split out from rust-lang/rust#141451, depends on rust-lang/rust#141442. r? `@compiler-errors`
2025-05-27Rename unpack to kindMichael Goulet-2/+2
2025-05-26add additional `TypeFlags` fast pathslcnr-1/+26
2025-04-29canonical no type foldable :<lcnr-2/+0
2025-04-28Add or-patterns to pattern typesOli Scherer-0/+1
2025-04-18Rollup merge of #138528 - dianne:implicit-deref-patterns, r=NadrierilMatthias Krüger-0/+6
deref patterns: implement implicit deref patterns This implements implicit deref patterns (per https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Implicit-deref-patterns) and adds tests and an unstable book chapter. Best reviewed commit-by-commit. Overall there's a lot of additions, but a lot of that is tests, documentation, and simple(?) refactoring. Tracking issue: #87121 r? ``@Nadrieril``
2025-04-15Split TypeFolder and FallibleTypeFolderMichael Goulet-66/+121
2025-04-12store the kind of pattern adjustments in `pat_adjustments`dianne-0/+6
This allows us to better distinguish builtin and overloaded implicit dereferences.
2025-04-04Fix `Debug` impl for `LateParamRegionKind`.Nicholas Nethercote-4/+4
It uses `Br` prefixes which are inappropriate and appear to have been incorrectly copy/pasted from the `Debug` impl for `BoundRegionKind`.
2025-03-15Fold visit into tyMichael Goulet-4/+2
2025-03-15Squash fold into tyMichael Goulet-2/+4
2025-03-12Move methods from `Map` to `TyCtxt`, part 4.Nicholas Nethercote-1/+1
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
2025-03-06Prefer a two value enum over boolOli Scherer-0/+1
2025-02-22Fix binding mode problemsMichael Goulet-8/+8
2025-02-19Make fewer crates depend on rustc_ast_irMichael Goulet-2/+1
2025-02-13intern valtreesLukas Markeffsky-6/+2
2025-02-06Fix whitespace in lift macros.Nicholas Nethercote-6/+12
This has been bugging me for some time.
2025-02-06Clean up trivial traversal/lift impl generator macro calls.Nicholas Nethercote-46/+92
We have four macros for generating trivial traversal (fold/visit) and lift impls. - `rustc_ir::TrivialTypeTraversalImpls` - `rustc_middle::TrivialTypeTraversalImpls` - `rustc_middle::TrivialLiftImpls` - `rustc_middle::TrivialTypeTraversalAndLiftImpls` The first two are very similar. The last one just combines the second and third one. The macros themselves are ok, but their use is a mess. This commit does the following. - Removes types that no longer need a lift and/or traversal impl from the macro calls. - Consolidates the macro calls into the smallest number of calls possible, with each one mentioning as many types as possible. - Orders the types within those macro calls alphabetically, and makes the module qualification more consistent. - Eliminates `rustc_middle::mir::type_foldable`, because the macro calls were merged and the manual `TypeFoldable` impls are better placed in `structural_impls.rs`, alongside all the other ones. This makes the code more concise. Moving forward, it also makes it more obvious where new types should be added.
2025-02-03Refactor using the type-level constant value `ty::Value`FedericoBruzzone-1/+1
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-30introduce `ty::Value`Lukas Markeffsky-12/+6
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-0/+2
2024-12-18introduce `LateParamRegionKind`lcnr-1/+17
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+2
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-11-23no more Reveal :(lcnr-1/+0
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-3/+3
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-5/+5
Stop reexporting ReprOptions from middle::ty
2024-10-22do not relate `Abi` and `Safety`lcnr-2/+5
and update some macros while we're at it
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-2/+2
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-10/+8
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-17lift_to_tcx -> lift_to_internerMichael Goulet-2/+2
2024-07-16Remove an unnecessary implOli Scherer-6/+0
2024-07-16Make `ErrorGuaranteed` discoverable outside types, consts, and lifetimesOli Scherer-2/+17
2024-06-21Rename a bunch of thingsMichael Goulet-4/+4
2024-06-11Remove DebugWithInfcxMichael Goulet-88/+15
2024-06-06Uplift TypeErrorMichael Goulet-7/+1
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-7/+10