mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
96d24f2dd1
This reverts commit65cd843ae0
, reversing changes made tod255c6a57c
.
102 lines
4.8 KiB
Plaintext
102 lines
4.8 KiB
Plaintext
warning: creating a mutable reference to mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:12:16
|
|
|
|
|
LL | c1(&mut Y);
|
|
| ^^^^^^ mutable reference to mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: this will be a hard error in the 2024 edition
|
|
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
|
|
= note: `#[warn(static_mut_refs)]` on by default
|
|
help: use `addr_of_mut!` instead to create a raw pointer
|
|
|
|
|
LL | c1(addr_of_mut!(Y));
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
warning: creating a mutable reference to mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:27:16
|
|
|
|
|
LL | c1(&mut Z);
|
|
| ^^^^^^ mutable reference to mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: this will be a hard error in the 2024 edition
|
|
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
|
|
help: use `addr_of_mut!` instead to create a raw pointer
|
|
|
|
|
LL | c1(addr_of_mut!(Z));
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
warning: creating a mutable reference to mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:37
|
|
|
|
|
LL | borrowck_closures_unique::e(&mut X);
|
|
| ^^^^^^ mutable reference to mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: this will be a hard error in the 2024 edition
|
|
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
|
|
help: use `addr_of_mut!` instead to create a raw pointer
|
|
|
|
|
LL | borrowck_closures_unique::e(addr_of_mut!(X));
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:9:46
|
|
|
|
|
LL | pub fn e(x: &'static mut isize) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
LL | static mut Y: isize = 3;
|
|
LL | let mut c1 = |y: &'static mut isize| x = y;
|
|
| ^^^^^ cannot assign
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:22:50
|
|
|
|
|
LL | pub fn ee(x: &'static mut isize) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
...
|
|
LL | let mut c2 = |y: &'static mut isize| x = y;
|
|
| ^^^^^ cannot assign
|
|
|
|
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:37:13
|
|
|
|
|
LL | pub fn capture_assign_whole(x: (i32,)) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
LL | || {
|
|
LL | x = (1,);
|
|
| ^^^^^^^^ cannot assign
|
|
|
|
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:13
|
|
|
|
|
LL | pub fn capture_assign_part(x: (i32,)) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
LL | || {
|
|
LL | x.0 = 1;
|
|
| ^^^^^^^ cannot assign
|
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:13
|
|
|
|
|
LL | pub fn capture_reborrow_whole(x: (i32,)) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
LL | || {
|
|
LL | &mut x;
|
|
| ^^^^^^ cannot borrow as mutable
|
|
|
|
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:55:13
|
|
|
|
|
LL | pub fn capture_reborrow_part(x: (i32,)) {
|
|
| - help: consider changing this to be mutable: `mut x`
|
|
LL | || {
|
|
LL | &mut x.0;
|
|
| ^^^^^^^^ cannot borrow as mutable
|
|
|
|
error: aborting due to 6 previous errors; 3 warnings emitted
|
|
|
|
Some errors have detailed explanations: E0594, E0596.
|
|
For more information about an error, try `rustc --explain E0594`.
|