2021-12-06 06:46:05 -06:00
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
|
2022-08-28 01:27:31 -05:00
|
|
|
#[const_trait]
|
2021-12-06 06:46:05 -06:00
|
|
|
trait Convert<T> {
|
|
|
|
fn to(self) -> T;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<A, B> const Convert<B> for A where B: ~const From<A> {
|
|
|
|
fn to(self) -> B {
|
|
|
|
B::from(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const FOO: fn() -> String = || "foo".to();
|
|
|
|
|
2021-12-05 05:03:01 -06:00
|
|
|
fn main() {}
|