rust/tests/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs
2023-01-11 09:32:08 +00:00

19 lines
276 B
Rust

// check-pass
#![feature(const_trait_impl)]
#[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() {}