Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk
Add EarlyBinder Chalk has no concept of `Param` (e0ade19d13/chalk-ir/src/lib.rs (L579)
) or `ReEarlyBound` (e0ade19d13/chalk-ir/src/lib.rs (L1308)
). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
This commit is contained in:
commit
2a8a0fc423
67 changed files with 400 additions and 217 deletions
|
@ -77,7 +77,7 @@ pub use self::sty::RegionKind::*;
|
|||
pub use self::sty::TyKind::*;
|
||||
pub use self::sty::{
|
||||
Binder, BoundRegion, BoundRegionKind, BoundTy, BoundTyKind, BoundVar, BoundVariableKind,
|
||||
CanonicalPolyFnSig, ClosureSubsts, ClosureSubstsParts, ConstVid, EarlyBoundRegion,
|
||||
CanonicalPolyFnSig, ClosureSubsts, ClosureSubstsParts, ConstVid, EarlyBinder, EarlyBoundRegion,
|
||||
ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, FnSig, FreeRegion, GenSig,
|
||||
GeneratorSubsts, GeneratorSubstsParts, InlineConstSubsts, InlineConstSubstsParts, ParamConst,
|
||||
ParamTy, PolyExistentialProjection, PolyExistentialTraitRef, PolyFnSig, PolyGenSig,
|
||||
|
@ -735,7 +735,7 @@ impl<'tcx> Predicate<'tcx> {
|
|||
let shifted_pred =
|
||||
tcx.shift_bound_var_indices(trait_bound_vars.len(), bound_pred.skip_binder());
|
||||
// 2) Self: Bar1<'a, '^0.1> -> T: Bar1<'^0.0, '^0.1>
|
||||
let new = shifted_pred.subst(tcx, trait_ref.skip_binder().substs);
|
||||
let new = EarlyBinder(shifted_pred).subst(tcx, trait_ref.skip_binder().substs);
|
||||
// 3) ['x] + ['b] -> ['x, 'b]
|
||||
let bound_vars =
|
||||
tcx.mk_bound_variable_kinds(trait_bound_vars.iter().chain(pred_bound_vars));
|
||||
|
@ -1931,7 +1931,7 @@ impl<'tcx> FieldDef {
|
|||
/// Returns the type of this field. The resulting type is not normalized. The `subst` is
|
||||
/// typically obtained via the second field of [`TyKind::Adt`].
|
||||
pub fn ty(&self, tcx: TyCtxt<'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
tcx.type_of(self.did).subst(tcx, subst)
|
||||
tcx.bound_type_of(self.did).subst(tcx, subst)
|
||||
}
|
||||
|
||||
/// Computes the `Ident` of this variant by looking up the `Span`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue