summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/flags.rs
AgeCommit message (Collapse)AuthorLines
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-02-21use `List<Ty<'tcx>>` for tupleslcnr-2/+2
2022-02-15Overhaul `Const`.Nicholas Nethercote-4/+4
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-15Overhaul `TyS` and `Ty`.Nicholas Nethercote-2/+2
Specifically, change `Ty` from this: ``` pub type Ty<'tcx> = &'tcx TyS<'tcx>; ``` to this ``` pub struct Ty<'tcx>(Interned<'tcx, TyS<'tcx>>); ``` There are two benefits to this. - It's now a first class type, so we can define methods on it. This means we can move a lot of methods away from `TyS`, leaving `TyS` as a barely-used type, which is appropriate given that it's not meant to be used directly. - The uniqueness requirement is now explicit, via the `Interned` type. E.g. the pointer-based `Eq` and `Hash` comes from `Interned`, rather than via `TyS`, which wasn't obvious at all. Much of this commit is boring churn. The interesting changes are in these files: - compiler/rustc_middle/src/arena.rs - compiler/rustc_middle/src/mir/visit.rs - compiler/rustc_middle/src/ty/context.rs - compiler/rustc_middle/src/ty/mod.rs Specifically: - Most mentions of `TyS` are removed. It's very much a dumb struct now; `Ty` has all the smarts. - `TyS` now has `crate` visibility instead of `pub`. - `TyS::make_for_test` is removed in favour of the static `BOOL_TY`, which just works better with the new structure. - The `Eq`/`Ord`/`Hash` impls are removed from `TyS`. `Interned`s impls of `Eq`/`Hash` now suffice. `Ord` is now partly on `Interned` (pointer-based, for the `Equal` case) and partly on `TyS` (contents-based, for the other cases). - There are many tedious sigil adjustments, i.e. adding or removing `*` or `&`. They seem to be unavoidable.
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-4/+0
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-0/+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-17Add term to ExistentialProjectionkadmin-1/+4
Also prevent ICE when adding a const in associated const equality.
2022-01-17Update term for use in more placeskadmin-1/+1
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.
2022-01-17Use Term in ProjectionPredicatekadmin-3/+6
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-15attempt to re-add `ty::Unevaluated` visitor and friendsEllen-3/+9
2022-01-15initial revertEllen-28/+6
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-3/+3
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-08-26reviewlcnr-0/+11
2021-08-26shrink `ty::PredicateKind` againlcnr-1/+1
2021-08-26use `ty::Unevaluated` instead of def substs pairlcnr-2/+2
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-4/+14
2021-08-26make unevaluated const substs optionallcnr-1/+2
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+4
2021-08-13move Constness into TraitPredicateDeadbeef-1/+1
2021-05-01Make `TypeFoldable::is_global()` false when fresh tys/consts are presentAaron Hill-2/+4
This ensures that `ParamEnv::and` preserves the original `caller_bounds` when we have a value containing fresh tys/consts. This ensures that when we cache a `SelectionCandidate`, the cache key (a `ParamEnvAnd`) contains all of the information that influenced the computation of our result (e.g. we may end up choosing a `ParamCandidate`)
2021-04-28Add HAS_RE_LATE_BOUND if there are bound varsJack Huey-0/+4
2021-03-31Add tcx lifetime to BinderJack Huey-3/+3
2021-03-20extract `ConstKind::Unevaluated` into a structlcnr-4/+6
2021-01-16Review changesJack Huey-14/+14
2021-01-16CleanupJack Huey-3/+3
2021-01-16Remove PredicateKindJack Huey-3/+2
2021-01-16Intermediate formatting and suchJack Huey-7/+2
2021-01-16Remove PredicateKind::AtomJack Huey-1/+0
2020-12-11Move binder for dyn to each list itemJack Huey-12/+8
2020-09-18guard against `skip_binder` errors during FlagComputationBastian Kauschke-34/+32
2020-09-18fix flag computation for `ExistentialPredicate::Projection`Bastian Kauschke-3/+1
2020-09-09Remove def_id field from ParamEnvBram van den Heuvel-0/+3
2020-09-04ty.flags -> ty.flags()LeSeulArtichaut-1/+1
2020-08-30mv compiler to compiler/mark-0/+330