4 // Fast path, main can see the concrete type returned.
5 fn before() -> impl Fn(i32) {
6 //~^ NOTE within this `impl Fn
7 //~| NOTE within the type `impl Fn
8 //~| NOTE expansion of desugaring
9 let p = Rc::new(Cell::new(0));
10 move |x| p.set(x) //~ NOTE used within this closure
13 fn send<T: Send>(_: T) {}
14 //~^ NOTE required by a bound
15 //~| NOTE required by a bound
16 //~| NOTE required by this bound
17 //~| NOTE required by this bound
21 //~^ ERROR `Rc<Cell<i32>>` cannot be sent between threads safely
22 //~| NOTE `Rc<Cell<i32>>` cannot be sent between threads safely
23 //~| NOTE required by a bound
26 //~^ ERROR `Rc<Cell<i32>>` cannot be sent between threads safely
27 //~| NOTE `Rc<Cell<i32>>` cannot be sent between threads safely
28 //~| NOTE required by a bound
31 // Deferred path, main has to wait until typeck finishes,
32 // to check if the return type of after is Send.
33 fn after() -> impl Fn(i32) {
34 //~^ NOTE within this `impl Fn(i32)`
35 //~| NOTE in this expansion
36 //~| NOTE appears within the type
37 let p = Rc::new(Cell::new(0));
38 move |x| p.set(x) //~ NOTE used within this closure