]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-unboxed-closures.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-unboxed-closures.rs
1 fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
2     let g = &mut f;
3     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
4     use_mut(g);
5 }
6 fn b<F:FnMut(isize, isize) -> isize>(f: F) {
7     f(1, 2);    //~ ERROR cannot borrow `f` as mutable, as it is not declared as mutable
8 }
9
10 fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
11     f(1, 2);
12     f(1, 2);    //~ ERROR use of moved value
13 }
14
15 fn main() {}
16
17 fn use_mut<T>(_: &mut T) { }