-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 with const generics with dependent const parameters #62879
Comments
This appears to be due to the fact that we always create an empty substs for an I'm not sure which approach would be correct. |
I was going to pick this up, but as of
Bisecting, the ICE was fixed in (cc @eddyb) |
Just out of curiosity, how is this a loop? I feel like this should be possible. |
@ranweiler Perhaps, at first glance this is an instance of #43408. The cycle error happens to be the canonical result of fixing #43408 without lazy normalization (which is what happened here for direct uses of @PvdBerg1998 First off, we're not even supposed to allow But also, what's happening is that computing the types of all the |
FYI this also occurs with bool instead of an array: #![feature(const_generics)]
trait Foo {}
impl<const N: usize> Foo for [(); N]
where
Self:FooImpl<{N==0}>
{}
trait FooImpl<const IS_ZERO: bool>{} See also #61935 (used to not ICE when I filed it, now it ICE's). |
Now it gives an error:
Same goes for @Centril 's bug report above. |
That's expected fallout from #66883 (explicitly needing lazy normalization rather than ICE-ing randomly). However, note that non-trivial expressions that use type/const parameters, should, outside of bounds / |
We can't really support the original example rn. See #74159 which makes this explicit and adds a regression test for #62878 #![feature(const_generics)]
fn foo<const N: usize, const A: [u8; N]>() {}
fn bar() {
foo::<1, {[1]}>();
} Didn't look too much into the rest of this issue, so there might still be something we want to do here before closing this |
results in an ICE:
The text was updated successfully, but these errors were encountered: