-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
cycle errors for unevaluated constants in the param env #79356
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-cycle
Issue: A query cycle occurred while none was expected
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
i think the same problem should also be also responsible for the cycle error in this example: #![feature(generic_const_exprs)]
trait Foo {
const N: usize;
}
struct Num<const N: usize>
where
[(); <Self as Foo>::N]: ;
impl<const N: usize> Foo for Num<N> {
const N: usize = N - 1;
} |
edit: using and #![feature(generic_const_exprs)]
trait Foo where [(); Self::N]: {
const N: usize;
} |
#![feature(const_generics)]
#![allow(incomplete_features)]
struct Foo<T>(T);
fn test() where [u8; {
let _: Foo<[u8; 3 + 4]>;
3
}]: Sized,
[u8; {
let _: Foo<[u8; 3 + 4]>;
4
}]: Sized {} |
the array len from the obligation does not have to be unevaluated. #![feature(generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo<T>(T);
fn test() where [u8; {
let _: Foo<[u8; 7]>;
3
}]: Sized {} |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-cycle
Issue: A query cycle occurred while none was expected
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
ends up failing with
The cycle happens while typechecking the outer array length. This happens because
Foo<[u8; 3 + 4]>
requires[u8; 3 + 4]
to be sized. While trying to fulfill this we see the[u8; ...]: Sized
bound in the param_env and try to unify these two. This causes us to evaluate both constants which once again relies on typechecking them.*This test succeeds with
min_const_generics
and currently fails withconst_generics
.The text was updated successfully, but these errors were encountered: