-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
ICE on generic associated type with a bound referencing the quantified type #63300
Comments
I'd like to take a look at this if no-one minds? @rustbot claim |
FWIW, it doesn't look like the bound has to reference the quantified type, this gives the same crash: trait Functor<A> {
type Associated<B>: Iterator<Item = B>;
} |
@jyn514 the bound didn’t reference the quantified type in the first example either did it? |
It referenced the trait, not the type being bounded. I was using the words that @Centril used for the issue title, maybe I'm getting the terminology wrong. |
This is particularly interesting because the ICE occurs even without |
…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
I was reading https://varkor.github.io/blog/2019/03/28/idiomatic-monads-in-rust.html and decided to try some of the code samples, but the compiler panicked!
Crashes with
error: internal compiler error: src/librustc/ty/subst.rs:570: type parameter
T/#2(T/2) out of range when substituting (root type=Some(T)) substs=[<Self as Functor<A>>::HigherSelf, T]
The compiler mentions that 'generic associated types are unstable', but the crash occurs even with the feature gate turned off. This happens on both
stable
andnightly
.Traceback
Version
This issue has been assigned to @doctorn via this comment.
The text was updated successfully, but these errors were encountered: