Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement type- and const-generic associated types #67513

Closed
Tracked by #44265
matthewjasper opened this issue Dec 22, 2019 · 2 comments
Closed
Tracked by #44265

Implement type- and const-generic associated types #67513

matthewjasper opened this issue Dec 22, 2019 · 2 comments
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthewjasper
Copy link
Contributor

matthewjasper commented Dec 22, 2019

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

@matthewjasper matthewjasper added E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. C-feature-accepted Category: A feature request that has been accepted pending implementation. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs labels Dec 22, 2019
@Centril Centril added requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 22, 2019
@tiannian
Copy link

Type arguments in GAT seems not yet implemented. Is this feature being implemented?

@matthewjasper
Copy link
Contributor Author

So, #72788 ended up allowing this because of changes to how bounds are handled. Any issues with this can be tracked in other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants