]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrow-immutable-upvar-mutation-impl-trait.rs
1 #![feature(unboxed_closures)]
2
3 // Tests that we can't assign to or mutably borrow upvars from `Fn`
4 // closures (issue #17780)
5
6 fn main() {}
7
8 fn bar() -> impl Fn() -> usize {
9     let mut x = 0;
10     move || {
11         x += 1; //~ ERROR cannot assign
12         x
13     }
14 }