Open
Description
#![feature(const_generics, const_evaluatable_checked)]
struct Bar<const N: usize>;
trait Foo {}
impl<const N: usize> Foo for Bar<N> where [u8; N - 1]: {}
impl Foo for Bar<0> {}
currently errors with
error[E0080]: evaluation of `<Bar<0_usize> as Foo>::{constant#0}` failed
--> src/lib.rs:6:48
|
6 | impl<const N: usize> Foo for Bar<N> where [u8; N - 1]: {}
| ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
while checking whether the two impls overlap during coherence. Failing to evaluate a generic constant in the where clauses should not eagerly cause an error if it happens during selection. See #81339 for how to fix this issue, I did not have the capacity to finish that PR.