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

GAT impl with type parameter causes ICE, even without feature enabled #64755

Closed
PlasmaPower opened this issue Sep 25, 2019 · 0 comments · Fixed by #67160
Closed

GAT impl with type parameter causes ICE, even without feature enabled #64755

PlasmaPower opened this issue Sep 25, 2019 · 0 comments · Fixed by #67160
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@PlasmaPower
Copy link
Contributor

This also applies to stable rust, since it still ICEs without the feature gate, though of course on stable there's no way to encounter it without having another error due to the feature not being enabled. It's similar to #60654 but with type parameters instead of lifetime parameters. Here's an example (playground link):

struct Foo;

trait MyTrait {
    type Item<T>;
}

impl MyTrait for Foo {
    type Item<T> = T;
}

This is a bit easier to encounter than that example shows, since type cohesion isn't checked for GATs yet, meaning that you can reproduce this by implementing the normal Iterator trait but still placing a type parameter on the Item type (note for whoever implements that: almost all of the code in rustc_typeck::check::compare_method is reusable there).

@csmoe csmoe added F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Sep 25, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 25, 2019
@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Sep 25, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
Centril added a commit to Centril/rust that referenced this issue Dec 21, 2019
…atsakis

Make GATs less ICE-prone.

After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations:

* rust-lang#30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs)
* Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving.
    * The errors are technically non-fatal, but they happen in a [part of the compiler](https://github.com/rust-lang/rust/blob/4abb0ad2731e9ac6fd5d64d4cf15b7c82e4b5a81/src/librustc_typeck/lib.rs#L298) that fairly aggressively stops compiling on errors.

closes rust-lang#47206
closes rust-lang#49362
closes rust-lang#62521
closes rust-lang#63300
closes rust-lang#64755
closes rust-lang#67089
@bors bors closed this as completed in b50c3b7 Dec 22, 2019
@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

Successfully merging a pull request may close this issue.

6 participants