rust/tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
408 B
Rust
Raw Normal View History

2023-12-14 06:11:28 -06:00
// compile-flags: -Znext-solver
2023-06-01 15:23:44 -05:00
// revisions: works fails
//[works] check-pass
trait Trait<const N: usize> {}
impl Trait<{ 1 - 1 }> for () {}
impl Trait<{ 1 + 1 }> for () {}
fn needs<const N: usize>() where (): Trait<N> {}
#[cfg(works)]
fn main() {
needs::<0>();
needs::<2>();
}
#[cfg(fails)]
fn main() {
needs::<1>();
//[fails]~^ ERROR the trait bound `(): Trait<1>` is not satisfied
}