summary refs log tree commit diff
path: root/tests/ui/thread-local/thread-local-static.stderr
blob: e1b1c4d03ff5ce5622684812caaae9b4195c7c22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
warning: creating a mutable reference to mutable static is discouraged
  --> $DIR/thread-local-static.rs:10:23
   |
LL |     std::mem::swap(x, &mut STATIC_VAR_2)
   |                       ^^^^^^^^^^^^^^^^^ 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 |     std::mem::swap(x, addr_of_mut!(STATIC_VAR_2))
   |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0133]: use of mutable static is unsafe and requires unsafe function or block
  --> $DIR/thread-local-static.rs:10:28
   |
LL |     std::mem::swap(x, &mut STATIC_VAR_2)
   |                            ^^^^^^^^^^^^ use of mutable static
   |
   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior

error[E0658]: mutable references are not allowed in constant functions
  --> $DIR/thread-local-static.rs:8:12
   |
LL | const fn g(x: &mut [u32; 8]) {
   |            ^
   |
   = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0625]: thread-local statics cannot be accessed at compile-time
  --> $DIR/thread-local-static.rs:10:28
   |
LL |     std::mem::swap(x, &mut STATIC_VAR_2)
   |                            ^^^^^^^^^^^^

error[E0013]: constant functions cannot refer to statics
  --> $DIR/thread-local-static.rs:10:28
   |
LL |     std::mem::swap(x, &mut STATIC_VAR_2)
   |                            ^^^^^^^^^^^^
   |
   = help: consider extracting the value of the `static` to a `const`, and referring to that

error[E0658]: mutable references are not allowed in constant functions
  --> $DIR/thread-local-static.rs:10:23
   |
LL |     std::mem::swap(x, &mut STATIC_VAR_2)
   |                       ^^^^^^^^^^^^^^^^^
   |
   = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
   = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 5 previous errors; 1 warning emitted

Some errors have detailed explanations: E0013, E0133, E0625, E0658.
For more information about an error, try `rustc --explain E0013`.