about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/relate.rs
AgeCommit message (Collapse)AuthorLines
2023-12-19Remove param env from relation altogetherMichael Goulet-2/+0
2023-12-19Do not evaluate in structurally_relate_tysMichael Goulet-7/+3
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-20s/generator/coroutine/Oli Scherer-4/+4
2023-10-20s/Generator/Coroutine/Oli Scherer-15/+15
2023-10-18AliasTy::new instead of tcx methodlcnr-1/+1
2023-10-04Make it clear that args default to being related invariantlyMichael Goulet-10/+10
2023-10-04Remove unnecessary relate implMichael Goulet-13/+0
2023-10-04Relate AliasTy considering varianceMichael Goulet-19/+15
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-12/+2
2023-08-02Remove constness from `TraitPredicate`Deadbeef-1/+0
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-77/+76
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-9/+3
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-17/+20
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-3/+6
2023-07-03fix structurally relate for weak aliaseslcnr-11/+15
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-1/+1
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-05-31move hack to `normalize_param_env_or_error`Boxy-11/+0
2023-05-15Rename super_relate_* to structurally_relate_*Michael Goulet-14/+17
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-0/+5
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-1/+1
2023-04-16Don't `use rustc_hir as ast`(!)Nicholas Nethercote-7/+7
It makes for confusing code. This was introduced in a large commit in #67886 that rearranged a lot of `use` statements. I suspect it was an accident.
2023-04-04Remove intercrate and mark_ambiguous from RelationMichael Goulet-22/+10
2023-02-24Rename many interner functions.Nicholas Nethercote-7/+8
(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-22Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_miscMichael Goulet-1/+1
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-2/+1
in metadata
2023-02-15Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, ↵bors-20/+0
r=compiler-errors use semantic equality for const param type equality assertion Fixes #107898 See added test for what caused this ICE --- The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics: - it will ICE when there are infer vars in a projection in a const param ty - it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq` - i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic. This impl feels pretty Not Great to me although i am not sure what a better idea would be. - We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing) - `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments. We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better. We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it. r? `@compiler-errors`
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-2/+2
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-1/+1
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-11make `relate`'s const ty assertion use semantic equalityBoxy-20/+0
2023-02-05emit `ConstEquate` in `TypeRelating<D>`Boxy-15/+15
2023-01-28Rollup merge of #107339 - aliemjay:covariant, r=lcnrMatthias Krüger-12/+2
internally change regions to be covariant Surprisingly, we consider the reference type `&'a T` to be contravaraint in its lifetime parameter. This is confusing and conflicts with the documentation we have in the reference, rustnomicon, and rustc-dev-guide. This also arguably not the correct use of terminology since we can use `&'static u8` in a place where `&' a u8` is expected, this implies that `&'static u8 <: &' a u8` and consequently `'static <: ' a`, hence covariance. Because of this, when relating two types, we used to switch the argument positions in a confusing way: `Subtype(&'a u8 <: &'b u8) => Subtype('b <: 'a) => Outlives('a: 'b) => RegionSubRegion('b <= 'a)` The reason for the current behavior is probably that we wanted `Subtype('b <: 'a)` and `RegionSubRegion('b <= 'a)` to be equivalent, but I don' t think this is a good reason since these relations are sufficiently different in that the first is a relation in the subtyping lattice and is intrinsic to the type-systems, while the the second relation is an implementation detail of regionck. This PR changes this behavior to use covariance, so.. `Subtype(&'a u8 <: &'b u8) => Subtype('a <: 'b) => Outlives('a: 'b) => RegionSubRegion('b <= 'a) ` Resolves #103676 r? `@lcnr`
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-0/+10
2023-01-27internally change regions to be covariantAli MJ Al-Nasrawy-12/+2
2023-01-11Reuse ErrorGuaranteed during relationMichael Goulet-1/+1
2022-12-18don't restuct references just to reborrowMatthias Krüger-1/+1
2022-12-14Prevent the creation of `TraitRef` without dedicated methodsOli Scherer-1/+1
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-2/+2
2022-12-14Guard `AliasTy` creation against passing the wrong number of substsOli Scherer-1/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-3/+3
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-7/+7
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-15/+7
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-3/+4
2022-12-13Fast path some binder relationsMichael Goulet-2/+2
2022-11-28Simplify calls to `tcx.mk_const`Maybe Waffle-4/+1
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to `mk_cosnt(..., ty)`. I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\ I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this way.
2022-11-25Make `expand_abstract_consts` infallibleBoxy-6/+2
2022-11-25`super_relate_consts` do not spurriously fail on assoc constsBoxy-16/+9
2022-11-25add FIXME'sBoxy-0/+3