about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/infer
AgeCommit message (Collapse)AuthorLines
2023-12-15NFC: do not clone types that are copyMatthias Krüger-2/+2
2023-12-14make infcx optional in canonicalizerAli MJ Al-Nasrawy-2/+10
This doesn't change behavior. It should prevent unintentional resolution of inference variables during canonicalization, which previously caused a soundness bug. See PR description for more.
2023-12-13fix small perf regressionsAli MJ Al-Nasrawy-1/+11
2023-12-13don't store OriginalQueryValues::universe_mapAli MJ Al-Nasrawy-4/+11
ParamEnv is canonicalized in *queries input* rather than query response. In such case we don't "preserve universes" of canonical variable. This means that `universe_map` always has the default value, which is wasteful to store in the cache.
2023-12-13global param_env canonicalization cacheAli MJ Al-Nasrawy-0/+37
2023-11-21Uplift CanonicalVarInfo and friendsMichael Goulet-153/+4
2023-11-14finish `RegionKind` renamelcnr-2/+2
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-6/+5
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-04No lifetime on PlaceholderConstMichael Goulet-1/+1
2023-10-25Uplift Canonical to rustc_type_irMichael Goulet-74/+6
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-8/+32
2023-10-13Format all the let chains in compilerMichael Goulet-1/+1
2023-09-24Remove span from BrAnon.Camille GILLOT-1/+1
2023-09-18Remove more unused `Lift` impls.Nicholas Nethercote-1/+1
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-5/+5
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.
2023-09-11Rollup merge of #115727 - fee1-dead-contrib:effect-fallback, r=oli-obkMatthias Krüger-16/+78
Implement fallback for effect param r? `@oli-obk` or `@lcnr` tracking issue for this ongoing work: https://github.com/rust-lang/rust/issues/110395
2023-09-11add `is_host_effect` to `GenericParamDefKind::Const` and address reviewDeadbeef-1/+0
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-0/+11
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-10Implement fallback for effect paramDeadbeef-16/+79
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-4/+4
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-4/+5
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-6/+7
2023-06-13opportunistically resolve regionsMichael Goulet-8/+33
2023-06-05Remove redundant InferCtxtExt::fresh_item_substsMichael Goulet-1/+0
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-1/+1
2023-05-10Use OpaqueTypeKey in query responseMichael Goulet-1/+1
2023-04-17Rollup merge of #110386 - nnethercote:clean-up-traversal-macros, r=lcnrMatthias Krüger-4/+2
Clean up traversal macros The declarative macros relating to type folding and visiting can be simplified. r? ``@lcnr``
2023-04-16Rollup merge of #109665 - fee1-dead-contrib:rm-remap-queries, r=oli-obkfee1-dead-8/+0
Remove `remap_env_constness` in queries This removes some of the complexities with const traits. #88119 used to be caused by this but was fixed by `param_env = param_env.without_const()`.
2023-04-16Simplify `CloneLiftImpls` and `TrivialTypeTraversalImpls`.Nicholas Nethercote-4/+2
They both allow for a lifetime other than `'tcx`, but this isn't needed.
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-04-10prioritize param-env candidateslcnr-0/+12
2023-04-08Remove `remap_env_constness` in queriesDeadbeef-8/+0
2023-04-06Remove index from BrAnonJack Huey-1/+1
2023-04-06Remove expect_anon and expect_anon_placeholder in favor of varJack Huey-6/+4
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-3/+5
PlaceholderRegion
2023-04-05Tweak debug outputs to make debugging new solver easierMichael Goulet-1/+1
2023-03-08Auto merge of #108121 - aliemjay:resolve-var-region, r=lcnrbors-4/+33
always resolve to universal regions if possible `RegionConstraintCollector::opportunistic_resolve_var`, which is used in canonicalization and projection logic, doesn't resolve the region var to an equal universal region. So if we have equated `'static == '1 == '2`, it doesn't resolve `'1` or `'2` to `'static`. Now it does! Addresses review comment https://github.com/rust-lang/rust/pull/107376#discussion_r1093233687. r? `@lcnr`
2023-03-08prefer universal from lower universeAli MJ Al-Nasrawy-1/+17
In case a variable is unified with two universal regions from different universes, use the one with the lower universe as it has a higher chance of being compatible with the variable.
2023-03-08address review commentAli MJ Al-Nasrawy-3/+16
2023-03-03canonicalizationlcnr-2/+63
2023-02-24Rename many interner functions.Nicholas Nethercote-2/+2
(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-2/+2
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-1/+1
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-13Make folding traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-3/+3
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-07remove binder from query constraintslcnr-4/+2
2023-01-26Make make_identity take CanonicalVarInfosMichael Goulet-27/+25
2023-01-26Intern CanonicalVarValuesMichael Goulet-31/+31
2023-01-18remove assembly context and impl a bit morelcnr-0/+6