]> git.lizzy.rs Git - rust.git/blob - tests/ui/generator/yield-while-ref-reborrowed.stderr
Rollup merge of #106144 - tgross35:patch-1, r=Mark-Simulacrum
[rust.git] / tests / ui / generator / yield-while-ref-reborrowed.stderr
1 error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
2   --> $DIR/yield-while-ref-reborrowed.rs:36:20
3    |
4 LL |     let mut b = || {
5    |                 -- generator construction occurs here
6 LL |         let a = &mut *x;
7    |                      -- first borrow occurs due to use of `x` in generator
8 ...
9 LL |     println!("{}", x);
10    |                    ^ second borrow occurs here
11 LL |     Pin::new(&mut b).resume(());
12    |              ------ first borrow later used here
13    |
14    = 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)
15
16 error: aborting due to previous error
17
18 For more information about this error, try `rustc --explain E0501`.