-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 crash #98702
Comments
@rustbot label +requires-nightly |
Minimized: #![feature(generic_associated_types)]
trait Foo {
type Assoc<T>;
}
impl Foo for () {
type Assoc<T> = [T; 2*2];
} |
@lcnr ^ |
The problem is we end up with When folding consts, we eval them (here:
Part of erasing regions is anonymizing late-bound regions (here:
In anonymize_late_bound_regions ( rust/compiler/rustc_middle/src/ty/fold.rs Line 920 in 9a6fa4f
replace_late_bound_regions , which returns T instead of Binder<T> , which "makes sense" if we assume that there are no bound tys or consts.
It's a bit of a tug of war game between wanting to catch unexpected bound tys/consts, and "delegating" bound variable binding higher up. Probably the right thing to do for now would be to revert the bound variable handling to just not panic if we encounter bound tys or consts. |
I guess alternatively, just anonymize all bound variables at this point? don't think regions should be special, going to try that |
The compiler crashes with an internal error on the following MWE of a GAT workaround attempt to current const generics limitations, i.e., not being able to just do
{N*N}
(or ratherpow(2, N)
in my real code). There is no crash ifT
is fixed to some type, i.e, GATs are not needed, however, the idea would be to limit “trait bound bloat” by only having to repeatNodeLookup : NodeT<N>
throughout the code withoutT
and its trait bounds, etc..Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: