-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Internal Tracking Issue for normalization redesign #155345
Copy link
Copy link
Open
Labels
A-technical-debtArea: Internal cleanup workArea: Internal cleanup workC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Description
Metadata
Metadata
Assignees
Labels
A-technical-debtArea: Internal cleanup workArea: Internal cleanup workC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Type
Fields
No fields configured for issues without a type.
This is a tracking issue to migrate the way we handle alias types (associated types, opaque types, etc) in the type system, and especially the next-generation trait solver
-Znext-solver. This is a large change and requires a lot of churn, because of this, it will land in multiple steps.This refactor includes the addition of a wrapper
struct Unnormalizedto explicitly track whether a type needs should be eagerly normalized. It also adds aIsRigidflag toTyKind::Alias, marking whether an alias is known to be rigid in the current context.This is in progress and we've somewhat adjusted this design as we've tried to implement it. For a terse and likely slightly outdated description, see https://hackmd.io/d4spupEOTySQmkz1gaPk1g.
Please contact @lcnr on the
#t-typeszulip stream in case there are questions or issues. While we're changing this, please do not hesitate to reach out in case the current state is unclear or confusing. If you want to help out, see the links to messages in the#t-types/trait-system-refactorzulip.Steps
ty::UnnormalizedIntroduceUnnormalizedwrapper #155083IsRigidAdd rigid alias marker #156742field.ty#156224t == cx.tcx.normalize_erasing_regions(cx.typing_env(), t)asserts should be someassert_fully_normalizedand don't useUnnormalized::new_wipstruct_tailshould takeUnnormalized<T>and returnTfield.tyshould returnUnnormalized. This can be done with changing the normalize method in borrowck typechecker to takeUnnormalized.fast_rejectconsiderIsRigidin fast path: perrrrfRigid aliases
eq_structurally_relating_aliases, have a special type folder to instantiate canonical responsesAliasRelate, lazily replace non-rigid aliases in type relations with infer var and directly emitProjectiongoals https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607084504ParamEnvnormalization to incorrectly mark things as rigidTypeOutliveshandling to only expect rigid aliases, eagerly normalize https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607084889IsRigid::Yesin region handlingEarlyBinder::bindto assert that there are no rigid aliases instead of implicitly replacing rigid aliases (manually replace them before then)ty::Unnormalizedcleanupnormalizefunction argument should change its signature https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607086444skip_norm_wip().def_idshould be replaced with adef_id()method onUnnormalized<Whateverhasadefid>https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607085904ty.fn_sigshould returnUnnormalizedhttps://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607086926HirTyLoweringuseUnnormalizedeverywhereDeeplyNormalize QueryTypeOpshould contain anUnnormalized<T>as input https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607086213normalize_with_depth_toshould takeUnnormalizedhttps://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/607086213Result<Ty<'tcx>, E>instead of being infallible to support eager errorsDropckConstraintshould haveUnnormalizedfields?PredicateKind::WellFormedgoals should takeUnnormalized<Term>Unnormalized::new_wipandskip_norm_wip