mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 05:56:56 +00:00
175 lines
7.3 KiB
Plaintext
175 lines
7.3 KiB
Plaintext
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:30:28
|
|
|
|
|
LL | super let b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:46:28
|
|
|
|
|
LL | super let b = &DropMe(&mut x);
|
|
| --------------
|
|
| | |
|
|
| | `x` is borrowed here
|
|
| a temporary with access to the borrow is created here ...
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:64:32
|
|
|
|
|
LL | super let b = identity(&DropMe(&mut x));
|
|
| --------------
|
|
| | |
|
|
| | `x` is borrowed here
|
|
| a temporary with access to the borrow is created here ...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | };
|
|
| - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:87:36
|
|
|
|
|
LL | super let b = identity(&DropMe(&mut x));
|
|
| --------------
|
|
| | |
|
|
| | `x` is borrowed here
|
|
| a temporary with access to the borrow is created here ...
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | ));
|
|
| - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:107:28
|
|
|
|
|
LL | super let b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:125:28
|
|
|
|
|
LL | super let b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:143:28
|
|
|
|
|
LL | super let b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:159:28
|
|
|
|
|
LL | b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
LL | drop(a);
|
|
| - borrow later used here
|
|
|
|
error[E0716]: temporary value dropped while borrowed
|
|
--> $DIR/super-let.rs:172:33
|
|
|
|
|
LL | #[cfg(borrowck)] { a = &String::from("asdf"); };
|
|
| ^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
|
|
| |
|
|
| creates a temporary value which is freed while still in use
|
|
...
|
|
LL | let _ = a;
|
|
| - borrow later used here
|
|
|
|
|
= note: consider using a `let` binding to create a longer lived value
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:206:28
|
|
|
|
|
LL | super let d = &DropMe(&mut x);
|
|
| --------------
|
|
| | |
|
|
| | `x` is borrowed here
|
|
| a temporary with access to the borrow is created here ...
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:227:32
|
|
|
|
|
LL | super let d = identity(&DropMe(&mut x));
|
|
| --------------
|
|
| | |
|
|
| | `x` is borrowed here
|
|
| a temporary with access to the borrow is created here ...
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | };
|
|
| - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:246:28
|
|
|
|
|
LL | super let b = DropMe(&mut x);
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error[E0506]: cannot assign to `x` because it is borrowed
|
|
--> $DIR/super-let.rs:263:28
|
|
|
|
|
LL | let dropme = Some(DropMe(&mut x));
|
|
| ------ `x` is borrowed here
|
|
...
|
|
LL | #[cfg(borrowck)] { x = true; }
|
|
| ^^^^^^^^ `x` is assigned to here but it was already borrowed
|
|
...
|
|
LL | }
|
|
| - borrow might be used here, when `x` is dropped and runs the `Drop` code for type `DropMe`
|
|
|
|
error: aborting due to 13 previous errors
|
|
|
|
Some errors have detailed explanations: E0506, E0716.
|
|
For more information about an error, try `rustc --explain E0506`.
|