2022-11-06 01:07:06 -05:00
|
|
|
// Tests that `T: ~const Foo` in a specializing impl is treated as equivalent to
|
|
|
|
// `T: Foo` in the default impl for the purposes of specialization (i.e., it
|
|
|
|
// does not think that the user is attempting to specialize on trait `Foo`).
|
2022-03-24 19:24:40 -05:00
|
|
|
|
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![feature(min_specialization)]
|
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
|
|
|
|
#[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 {}
|
|
|
|
|
2022-11-05 23:12:57 -05:00
|
|
|
#[const_trait]
|
2022-03-24 19:24:40 -05:00
|
|
|
trait Bar {}
|
|
|
|
|
2022-09-13 22:18:14 -05:00
|
|
|
impl<T> Bar for T
|
2022-03-24 19:24:40 -05:00
|
|
|
where
|
2022-09-13 22:18:14 -05:00
|
|
|
T: Foo,
|
2022-03-24 19:24:40 -05:00
|
|
|
{}
|
|
|
|
|
2022-09-13 22:18:14 -05:00
|
|
|
impl<T> const Bar for T
|
2022-03-24 19:24:40 -05:00
|
|
|
where
|
2022-09-13 22:18:14 -05:00
|
|
|
T: ~const Foo,
|
2022-03-24 19:24:40 -05:00
|
|
|
T: Specialize,
|
|
|
|
{}
|
|
|
|
|
2022-11-06 01:07:06 -05:00
|
|
|
#[const_trait]
|
|
|
|
trait Baz {}
|
|
|
|
|
|
|
|
impl<T> const Baz for T
|
|
|
|
where
|
|
|
|
T: Foo,
|
|
|
|
{}
|
|
|
|
|
|
|
|
impl<T> const Baz for T
|
|
|
|
where
|
|
|
|
T: ~const Foo,
|
|
|
|
T: Specialize,
|
|
|
|
{}
|
|
|
|
|
2022-03-24 19:24:40 -05:00
|
|
|
fn main() {}
|