This commit is contained in:
Deadbeef 2021-12-06 20:46:05 +08:00
parent e70e4d499d
commit 5166f68754
No known key found for this signature in database
GPG key ID: 6D017A96D8E6C2F9
3 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,18 @@
// check-pass
#![feature(const_trait_impl)]
#![feature(const_fn_trait_bound)]
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() {}