-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.