-
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] Const generics + Const normalization + Specialization #72845
Comments
This ICEs since |
…e, r=oli-obk Allow for failure of subst_normalize_erasing_regions in const_eval Fixes rust-lang#72845 Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case. r? `@RalfJung` maybe?
…e, r=oli-obk Allow for failure of subst_normalize_erasing_regions in const_eval Fixes rust-lang#72845 Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case. r? ``@RalfJung`` maybe?
Well, this still crashes if I add a
|
Good catch, the test case is slightly different to the one in glacier --- glacier.rs 2021-12-09 22:59:25.365148200 +0000
+++ test.rs 2021-12-09 23:02:06.135999800 +0000
@@ -26,9 +26,10 @@
impl<T: Type> Spec1 for T where Predicate<{T::AT::C > 0}>: Satisfied {}
-trait Spec2: Spec1 {}
+trait Spec2 {}
-impl<T: Type + Spec1> Spec2 for T where Predicate<{T::AT::C > 1}>: Satisfied {}
+//impl<T: Type > Spec2 for T where Predicate<{T::AT::C > 1}>: Satisfied {}
+impl<T: Type > Spec2 for T where Predicate<true>: Satisfied {}
//-------------------------------------------------- |
This still causes an ICE with the following code. #![feature(generic_const_exprs)]
#![feature(specialization)]
#![allow(incomplete_features)]
//--------------------------------------------------
trait Depth {
const C: usize;
}
trait Type {
type At: Depth;
}
//--------------------------------------------------
enum Predicate<const B: bool> {}
trait Satisfied {}
impl Satisfied for Predicate<true> {}
//--------------------------------------------------
trait Spec1 {}
impl<T: Type> Spec1 for T where Predicate<{ T::At::C > 0 }>: Satisfied {}
trait Spec2: Spec1 {}
impl<T: Type + Spec1> Spec2 for T where Predicate<{ T::At::C > 1 }>: Satisfied {}
//--------------------------------------------------
trait Foo {
fn Bar();
}
impl<T: Spec1> Foo for T {
default fn Bar() {}
}
impl<T: Spec2> Foo for T {
fn Bar() {}
} seems interesting, probably caused by rust-lang/project-const-generics#37 |
Test was added as const-generics/issues/issue-72845.rs , closing |
Found while toying around #20400.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: