-
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
Post lazy normalization for consts cleanup (#71973) #72129
Comments
done Add #![feature(const_generics)]
#![allow(incomplete_features)]
trait Bar<T> {}
impl<T> Bar<T> for [u8; T] {}
//~^ ERROR expected value, found type parameter `T`
struct Foo<const N: usize> {}
impl<const N: usize> Foo<N>
where
[u8; N]: Bar<[(); N]>,
{
fn foo() {}
}
fn main() {
Foo::foo();
} Also add the following similar test, which should compile but also causes a stack overflow. // run-pass
#![feature(const_generics)]
#![allow(incomplete_features, unused_braces)]
trait Bar<T> {}
impl<T> Bar<T> for [u8; {7}] {}
struct Foo<const N: usize> {}
impl<const N: usize> Foo<N>
where
[u8; N]: Bar<[(); N]>,
{
fn foo() {}
}
fn main() {
Foo::foo();
} |
Taken from a comment by @nikomatsakis // run-pass
#![feature(const_generics)]
#![feature(lazy_normalization_consts)]
#![allow(incomplete_features)]
// try to devise a test for higher-ranked case
//
// e.g., for<'a> EqZero<<() as Zero<'a>::C>>
//
//
trait EqZero<const C: usize> { }
impl EqZero<0> for () { }
trait Zero<'a> {
const C: usize;
}
impl<'a> Zero<'a> for () {
const C: usize = 0;
}
fn test_me<T>()
where for<'a> T: EqZero<{<() as Zero<'a>>::C}>
{
}
fn main() {
test_me::<()>();
}
|
Linking the relevant Zulip conversation here, which is helpful. |
the remaining work is tracked in different issues, most notably rust-lang/project-const-generics#35 |
While #71973 implements lazy normalization for constants,
there are still some bugs we need to deal with afterwards.
This issue is a collection of things not explicitly mentioned with
FIXME(lazy_normalization_consts)
so we don't forget anything.The text was updated successfully, but these errors were encountered: