Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(existential_type)]
- #![feature(impl_trait_in_bindings)]
- existential type T: Tr;
- trait Tr {}
- struct S<M> {
- m : M
- }
- impl<M> S<M> {
- fn new(m: M) -> Self {
- S { m }
- }
- }
- impl<M> Tr for S<M> {}
- pub fn new<F, M>(f: F) -> T
- where F: FnOnce() -> S<M>
- {
- f()
- }
- pub fn new2<M>(m: M) -> impl Tr {
- S::new(m)
- }
- fn main() {
- println!("Hello, world!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement