about summary refs log tree commit diff
path: root/tests/ui/ergonomic-clones/closure/nested.rs
blob: fc364fb594b2cd270ad42551c4307976940143cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ run-pass

#![feature(ergonomic_clones)]
#![allow(incomplete_features)]

use std::clone::UseCloned;

#[derive(Clone)]
struct Foo;

impl UseCloned for Foo {}

fn work(_: Box<Foo>) {}
fn foo<F:FnOnce()>(_: F) {}

pub fn main() {
  let a = Box::new(Foo);
  foo(use || { foo(use || { work(a) }) });
  let x = use || { use || { Foo } };
  let _y = x();
}