about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/fold.rs
AgeCommit message (Collapse)AuthorLines
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
2022-10-17mir constants: type traversing bye byelcnr-40/+0
2022-10-14more dupe word typosRageking8-2/+1
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-10/+16
2022-09-22introduce mir::Unevaluatedb-naber-4/+22
2022-09-17Auto merge of #101857 - lcnr:make-dyn-again, r=jackh726bors-17/+13
change `FnMutDelegate` to trait objects cc #100016 as mentioned in the last t-compiler meeting r? `@jackh726`
2022-09-15change `FnMutDelegate` to trait objectslcnr-17/+13
2022-09-14address review againb-naber-0/+11
2022-09-01tracing::instrument cleanupOli Scherer-1/+1
2022-07-29optimize bound vars replacement :3lcnr-18/+22
2022-07-28anonymize all bound vars, not just regionslcnr-6/+51
2022-07-28`BoundVarReplacer`: trait object instead of 3 fnslcnr-66/+68
2022-07-14eagerly check for bound vars of predicateslcnr-0/+4
2022-07-14remove `ct.has_vars_bound_at_or_above` callslcnr-2/+1
`ty::Const` doesn't have precomputed type flags, so computing `has_vars_bound_at_or_above` for constants requires us to visit the const and its contained types and constants. A noop fold should be pretty much equally as fast so removing it prevents us from walking the constant twice in case it contains bound vars.
2022-07-05Split TypeVisitable from TypeFoldableAlan Egerton-733/+35
2022-06-27fold_region: remove unused parameterlcnr-6/+2
2022-06-21Remove unecessary references to TypeFolder::ErrorAlan Egerton-21/+15
2022-06-21Reverse folder hierarchyAlan Egerton-30/+19
#91318 introduced a trait for infallible folders distinct from the fallible version. For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible. Moreover the `Error` associated type was defined on the infallible trait! It's so absurd that it has me questioning whether I was entirely sane. This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation). This of course makes much more sense! It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs. There is one downside however: folders expose a `tcx` accessor method. Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate. Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate. If desired, I can submit that as a separate PR. r? @jackh726
2022-06-20`try_fold_unevaluated` for infallible foldersAlan Egerton-0/+7
#97447 added folding of unevaluated constants, but did not include an override of the default (fallible) operation in the blanket impl of `FallibleTypeFolder` for infallible folders. Here we provide that missing override. r? @nnethercote
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-7/+7
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-10don't always cache bound ltslcnr-9/+18