]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/auto-trait-leak-rpass.rs
Fix #106496, suggest remove deref for type mismatch
[rust.git] / tests / 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 }