Skip to content

Implement type- and const-generic associated types #67513

Closed
@matthewjasper

Description

The compiler errors for the following code:

#![feature(generic_associated_types)]

trait X {
    type Y<T>;
}

This is due to the compiler having no way to represent the implicit for<T: Sized> Y<T>: Sized bound on the trait. Some things that would need to be fixed before this can happen are:

  • The handling of bound and placeholder types and constants in the compiler needs to be reviewed.
  • There needs to be a way to represent traits bounds on bound types. I think the bound above is supposed to become for<T> if T: Sized { Y<T>: Sized }.
  • Maybe Chalk needs to progress further? Without Chalk we can at least get to the point of trait errors due to lack of (lazy) normalization.

cc @rust-lang/wg-traits

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)C-feature-acceptedCategory: A feature request that has been accepted pending implementation.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions