2024-10-21 20:16:33 +00:00
|
|
|
//@ compile-flags: -Znext-solver
|
2024-10-30 18:03:44 +00:00
|
|
|
#![feature(const_trait_impl)]
|
2024-10-21 20:16:33 +00:00
|
|
|
|
|
|
|
|
#[const_trait] trait Foo {
|
2025-03-11 12:08:45 +00:00
|
|
|
type Assoc<T>: [const] Bar
|
2024-10-21 20:16:33 +00:00
|
|
|
where
|
2025-03-11 12:08:45 +00:00
|
|
|
T: [const] Bar;
|
2024-10-21 20:16:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[const_trait] trait Bar {}
|
|
|
|
|
struct N<T>(T);
|
|
|
|
|
impl<T> Bar for N<T> where T: Bar {}
|
|
|
|
|
struct C<T>(T);
|
2025-03-11 12:08:45 +00:00
|
|
|
impl<T> const Bar for C<T> where T: [const] Bar {}
|
2024-10-21 20:16:33 +00:00
|
|
|
|
|
|
|
|
impl const Foo for u32 {
|
|
|
|
|
type Assoc<T> = N<T>
|
2025-03-11 12:08:45 +00:00
|
|
|
//~^ ERROR the trait bound `N<T>: [const] Bar` is not satisfied
|
2024-10-21 20:16:33 +00:00
|
|
|
where
|
2025-03-11 12:08:45 +00:00
|
|
|
T: [const] Bar;
|
2024-10-21 20:16:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl const Foo for i32 {
|
|
|
|
|
type Assoc<T> = C<T>
|
2025-03-11 12:08:45 +00:00
|
|
|
//~^ ERROR the trait bound `T: [const] Bar` is not satisfied
|
2024-10-21 20:16:33 +00:00
|
|
|
where
|
|
|
|
|
T: Bar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {}
|