about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/fold.rs
AgeCommit message (Collapse)AuthorLines
2025-09-30Split Bound into Canonical and Boundjackh726-4/+10
2025-07-31Make const bound handling more like types/regions.Nicholas Nethercote-9/+15
Currently there is `Ty` and `BoundTy`, and `Region` and `BoundRegion`, and `Const` and... `BoundVar`. An annoying inconsistency. This commit repurposes the existing `BoundConst`, which was barely used, so it's the partner to `Const`. Unlike `BoundTy`/`BoundRegion` it lacks a `kind` field but it's still nice to have because it makes the const code more similar to the ty/region code everywhere. The commit also removes `impl From<BoundVar> for BoundTy`, which has a single use and doesn't seem worth it. These changes fix the "FIXME: We really should have a separate `BoundConst` for consts".
2025-05-26add additional `TypeFlags` fast pathslcnr-0/+4
2025-04-14Use `newtype_index!`-generated types more idiomaticallyYotam Ofek-1/+1
2025-04-08clean code: remove Deref<Target=RegionKind> impl for Region and use `.kind()`xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-15Squash fold into tyMichael Goulet-7/+6
2025-02-08Rustfmtbjorn3-14/+19
2024-12-18introduce `LateParamRegionKind`lcnr-1/+2
2024-11-28uplift fold_regions to rustc_type_irlcnr-81/+2
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-1/+1
2024-10-02reviewlcnr-8/+9
2024-10-01add caches to multiple type folderslcnr-2/+23
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-20/+15
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-21Rename a bunch of thingsMichael Goulet-3/+3
2024-06-05Basic removal of `Ty` from places (boring)Boxy-11/+9
2024-05-26Uplift EarlyBinderMichael Goulet-101/+3
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-03-27Remove `Partial/Ord` from `BoundRegion`Oli Scherer-4/+2
2024-02-12Dejargnonize substShoyu Vanilla-2/+2
2023-11-17rename bound region instantiationlcnr-6/+6
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
2023-11-14finish `RegionKind` renamelcnr-1/+1
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-16/+14
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-09-24Remove span from BrAnon.Camille GILLOT-1/+1
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-3/+7
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-3/+3
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-6/+7
2023-04-16Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.Nicholas Nethercote-1/+2
These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods.
2023-04-06Remove u32 on BoundTyKind::AnonJack Huey-3/+1
2023-04-06Remove index from BrAnonJack Huey-3/+1
2023-03-20drive-by: Fix a comment in TyCtxt::fold_regions and remove an unused methodMichael Goulet-14/+1
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-22Remove type-traversal trait aliasesAlan Egerton-29/+20
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-11/+7
Much like there are specialized variants of `mk_ty`. This will enable some optimization in the next commit. Also rename the existing `re_error*` functions as `mk_re_error*`, for consistency.
2023-02-15Remove `reuse_or_mk_region`.Nicholas Nethercote-1/+1
It's not used on any hot paths, and so has little perf benefit, and it interferes with the optimizations in the following commits.
2023-02-13Rename folder traits' `tcx` method to `interner`Alan Egerton-4/+4
2023-02-13Move folding and visiting traits into type libraryAlan Egerton-239/+3
2023-02-13Make folding traits generic over the InternerAlan Egerton-49/+79
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-5/+8
2023-02-13Move folding & visiting traits to ir submodulesAlan Egerton-130/+142
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-6/+3
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-03Make const/fn return params more suggestableMichael Goulet-1/+1
2023-01-30Track bound types like bound regionsMichael Goulet-1/+3
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2022-12-14always use anonymize_bound_varsMichael Goulet-30/+0
2022-11-26simplify some binder shifting logicMichael Goulet-23/+24
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-3/+5
error from generator interior
2022-11-04Refactor tcx mk_const parameters.Mateusz-9/+3
2022-10-19stop folding `UnevaluatedConst`lcnr-21/+0