1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl)]
#[const_trait] trait Bar {}
impl const Bar for () {}
#[const_trait] trait TildeConst {
type Bar<T> where T: ~const Bar;
fn foo<T>() where T: ~const Bar;
}
impl TildeConst for () {
type Bar<T> = () where T: const Bar;
//~^ ERROR impl has stricter requirements than trait
fn foo<T>() where T: const Bar {}
//~^ ERROR impl has stricter requirements than trait
}
#[const_trait] trait NeverConst {
type Bar<T> where T: Bar;
fn foo<T>() where T: Bar;
}
impl NeverConst for i32 {
type Bar<T> = () where T: const Bar;
//~^ ERROR impl has stricter requirements than trait
fn foo<T>() where T: const Bar {}
//~^ ERROR impl has stricter requirements than trait
}
impl const NeverConst for u32 {
type Bar<T> = () where T: ~const Bar;
//~^ ERROR impl has stricter requirements than trait
fn foo<T>() where T: ~const Bar {}
//~^ ERROR impl has stricter requirements than trait
}
fn main() {}
|