mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00
19 lines
293 B
Rust
19 lines
293 B
Rust
#![feature(const_trait_impl, const_convert)]
|
|
|
|
//@ check-pass
|
|
|
|
#[const_trait]
|
|
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();
|
|
|
|
fn main() {}
|