]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr
Fix incorrect use mut diagnostics
[rust.git] / src / test / ui / closures / 2229_closure_analysis / diagnostics / simple-struct-min-capture.stderr
1 warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes
2   --> $DIR/simple-struct-min-capture.rs:4:12
3    |
4 LL | #![feature(capture_disjoint_fields)]
5    |            ^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `#[warn(incomplete_features)]` on by default
8    = note: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> for more information
9
10 error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
11   --> $DIR/simple-struct-min-capture.rs:23:22
12    |
13 LL |     let mut c = || {
14    |                 -- mutable borrow occurs here
15 LL |         p.x += 10;
16    |         - first borrow occurs due to use of `p` in closure
17 ...
18 LL |     println!("{:?}", p);
19    |                      ^ immutable borrow occurs here
20 LL |
21 LL |     c();
22    |     - mutable borrow later used here
23
24 error: aborting due to previous error; 1 warning emitted
25
26 For more information about this error, try `rustc --explain E0502`.