about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/infer
AgeCommit message (Collapse)AuthorLines
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
2023-01-17new trait solver: only consider goal changed if response is not identityMichael Goulet-0/+16
2023-01-03Simplify some canonical type alias namesMichael Goulet-3/+1
2022-12-19implement the skeleton of the updated trait solverlcnr-0/+10
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-2/+4
error from generator interior
2022-11-04Refactor tcx mk_const parameters.Mateusz-4/+4
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-2/+4
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-4/+2
2022-09-22Const unification is already infallible, remove the error handling logicOli Scherer-1/+1
2022-09-16Make QueryOutlivesConstraint contain a ConstraintCategoryJack Huey-2/+5
2022-09-16Revert "Better errors for implied static bound"Jack Huey-5/+2
This reverts commit c75817b0a75d4b6b01ee10900ba5d01d4915e6a8.
2022-09-15Merge all `TypeVisitable for &List<T>` impls into one generic oneOli Scherer-8/+12
2022-09-13Better errors for implied static boundJack Huey-2/+5
2022-08-01make `PlaceholderConst` not store the type of the constEllen-3/+3
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-4/+4
2022-07-19Use LocalDefId in OpaqueTypeKeyMichael Goulet-2/+2
2022-07-05impl TypeVisitable in type traversal macrosAlan Egerton-2/+2
2022-07-05Add #[derive(TypeVisitable)]Alan Egerton-5/+5
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-1/+1
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-05-02fix most compiler/ doctestsElliot Roberts-1/+1
2022-04-01remove unused incorrect `EqUnifyValue` impllcnr-3/+1
2022-04-01remove `unify_key::replace_if_possible`lcnr-25/+2
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-0/+6
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-02-15Inline UnifyKey::index and UnifyKey::from_indexTomasz Miąsko-0/+4
2022-02-15Overhaul `Const`.Nicholas Nethercote-10/+10
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
2022-02-11Renumber universes when canonicalizing for ChalkMatthew Jasper-3/+3
This is required to avoid creating large numbers of universes from each Chalk query, while still having enough universe information for lifetime errors.
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-6/+0
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-03Clean up opaque type obligations in query resultsOli Scherer-4/+7
2022-02-02Clean up leftovers from eager hidden type mergingOli Scherer-1/+1
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-1/+4
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-01-12Canonicalize const variables correctlyMichael Goulet-4/+4
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-2/+2
See #91867 This was mostly straightforward. In several places, I take advantage of the fact that lifetimes are non-hygenic: a macro declares the 'tcx' lifetime, which is then used in types passed in as macro arguments.
2021-12-12Remap more env constness for queriesDeadbeef-0/+8
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+1
2021-05-15Add commentJack Huey-0/+3
2021-05-14Store Option<Region> as value for RegionVidJack Huey-22/+30