]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.rs
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
[rust.git] / src / test / 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 }