102 lines
4.9 KiB
Plaintext
102 lines
4.9 KiB
Plaintext
warning: mutable reference of mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:12:16
|
|
|
|
|
LL | c1(&mut Y);
|
|
| ^^^^^^ mutable reference of mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: reference of mutable static is a hard error from 2024 edition
|
|
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
|
|
= note: `#[warn(static_mut_ref)]` on by default
|
|
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
|
|
|
|
|
LL | c1(addr_of_mut!(Y));
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
warning: mutable reference of mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:27:16
|
|
|
|
|
LL | c1(&mut Z);
|
|
| ^^^^^^ mutable reference of mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: reference of mutable static is a hard error from 2024 edition
|
|
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
|
|
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
|
|
|
|
|
LL | c1(addr_of_mut!(Z));
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
warning: mutable reference of mutable static is discouraged
|
|
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:37
|
|
|
|
|
LL | borrowck_closures_unique::e(&mut X);
|
|
| ^^^^^^ mutable reference of mutable static
|
|
|
|
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
|
= note: reference of mutable static is a hard error from 2024 edition
|
|
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
|
|
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; 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`.
|