2022-03-24 19:24:40 -05:00
|
|
|
// Tests that `~const` trait bounds can be used to specialize const trait impls.
|
|
|
|
|
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![feature(min_specialization)]
|
|
|
|
|
2022-11-05 23:12:57 -05:00
|
|
|
#[const_trait]
|
2022-03-24 19:24:40 -05:00
|
|
|
#[rustc_specialization_trait]
|
|
|
|
trait Specialize {}
|
|
|
|
|
2022-11-05 23:12:57 -05:00
|
|
|
#[const_trait]
|
2022-03-24 19:24:40 -05:00
|
|
|
trait Foo {}
|
|
|
|
|
|
|
|
impl<T> const Foo for T {}
|
|
|
|
|
|
|
|
impl<T> const Foo for T
|
|
|
|
where
|
|
|
|
T: ~const Specialize,
|
|
|
|
{}
|
|
|
|
|
2022-11-05 23:12:57 -05:00
|
|
|
#[const_trait]
|
2022-03-24 19:24:40 -05:00
|
|
|
trait Bar {}
|
|
|
|
|
|
|
|
impl<T> const Bar for T
|
|
|
|
where
|
|
|
|
T: ~const Foo,
|
|
|
|
{}
|
|
|
|
|
|
|
|
impl<T> const Bar for T
|
|
|
|
where
|
|
|
|
T: ~const Foo,
|
|
|
|
T: ~const Specialize,
|
|
|
|
{}
|
|
|
|
|
|
|
|
fn main() {}
|