Skip to content

introduce a fresh variant for "non-normalized" associated types #53683

Closed
@nikomatsakis

Description

@nikomatsakis

In the compiler today, we have one variant for associated type projections (e.g., T::Foo):

rust/src/librustc/ty/sty.rs

Lines 156 to 158 in 727eabd

/// The projection of an associated type. For example,
/// `<T as Trait<..>>::N`.
Projection(ProjectionTy<'tcx>),

We use context to know whether this is normalized or not -- basically, it should always be normalized, unless the type results from one of those queries that fetches the type that the user wrote for something like a field etc. In the lazy normalization approach that Chalk uses, however, we would want to be able to explicitly represent this difference.

The job here is to add a new variant. I think we should call it TyUnnormalizedProjection. This would be entirely unused for now -- but when we start to enable chalk, we will create this type when translating user types directly, and only create TyProjection in the case that we have attempted to normalize the projection and failed.

cc @tmandry @scalexm

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-traitsWorking group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions