]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr
Rollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errors
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / simple-struct-min-capture.stderr
1 error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
2   --> $DIR/simple-struct-min-capture.rs:22:22
3    |
4 LL |     let mut c = || {
5    |                 -- mutable borrow occurs here
6 LL |         p.x += 10;
7    |         --- capture is mutable because of use here
8 LL |         println!("{:?}", p);
9    |                          - first borrow occurs due to use of `p` in closure
10 ...
11 LL |     println!("{:?}", p);
12    |                      ^ immutable borrow occurs here
13 LL |
14 LL |     c();
15    |     - mutable borrow later used here
16    |
17    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
18
19 error: aborting due to previous error
20
21 For more information about this error, try `rustc --explain E0502`.