]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-blanket-fn-mut.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-blanket-fn-mut.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // Test that you can supply `&F` where `F: FnMut()`.
4
5 #![feature(lang_items)]
6
7 fn a<F:FnMut() -> i32>(mut f: F) -> i32 {
8     f()
9 }
10
11 fn b(f: &mut dyn FnMut() -> i32) -> i32 {
12     a(f)
13 }
14
15 fn c<F:FnMut() -> i32>(f: &mut F) -> i32 {
16     a(f)
17 }
18
19 fn main() {
20     let z: isize = 7;
21
22     let x = b(&mut || 22);
23     assert_eq!(x, 22);
24
25     let x = c(&mut || 22);
26     assert_eq!(x, 22);
27 }