]> git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-2.stderr
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / diagnostics / borrowck / borrowck-2.stderr
1 warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/borrowck-2.rs:1: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 mutable because it is also borrowed as immutable
11 --> $DIR/borrowck-2.rs:13:17
12 |
13 LL | let y = &p.y;
14 | ---- immutable borrow occurs here
15 LL | let mut c = || {
16 | ^^ mutable borrow occurs here
17 LL |
18 LL | println!("{:?}", p);
19 | - second borrow occurs due to use of `p` in closure
20 LL | let x = &mut p.x;
21 | --- capture is mutable because of use here
22 ...
23 LL | println!("{}", y);
24 | - immutable borrow later used here
25
26 error: aborting due to previous error; 1 warning emitted
27
28 For more information about this error, try `rustc --explain E0502`.