1
Fork 0
rust/src/test/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.rs

18 lines
294 B
Rust
Raw Normal View History

2021-12-06 20:46:05 +08:00
// 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() {}