]> git.proxmox.com Git - rustc.git/blob - src/test/ui/impl-trait/auto-trait-leak-rpass.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / impl-trait / auto-trait-leak-rpass.rs
1 // run-pass
2
3 // Fast path, main can see the concrete type returned.
4 fn before() -> impl FnMut(i32) {
5 let mut p = Box::new(0);
6 move |x| *p = x
7 }
8
9 fn send<T: Send>(_: T) {}
10
11 fn main() {
12 send(before());
13 send(after());
14 }
15
16 // Deferred path, main has to wait until typeck finishes,
17 // to check if the return type of after is Send.
18 fn after() -> impl FnMut(i32) {
19 let mut p = Box::new(0);
20 move |x| *p = x
21 }