|
1 | 1 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
2 |
| - --> $DIR/reference_casting.rs:20:9 |
| 2 | + --> $DIR/reference_casting.rs:19:9 |
3 | 3 | |
|
4 | 4 | LL | (*(a as *const _ as *mut String)).push_str(" world");
|
5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
6 | 6 | |
|
7 |
| -note: the lint level is defined here |
8 |
| - --> $DIR/reference_casting.rs:4:9 |
9 |
| - | |
10 |
| -LL | #![deny(invalid_reference_casting)] |
11 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 7 | + = note: `#[deny(invalid_reference_casting)]` on by default |
12 | 8 |
|
13 | 9 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
14 |
| - --> $DIR/reference_casting.rs:22:9 |
| 10 | + --> $DIR/reference_casting.rs:21:9 |
15 | 11 | |
|
16 | 12 | LL | *(a as *const _ as *mut _) = String::from("Replaced");
|
17 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
18 | 14 |
|
19 | 15 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
20 |
| - --> $DIR/reference_casting.rs:24:9 |
| 16 | + --> $DIR/reference_casting.rs:23:9 |
21 | 17 | |
|
22 | 18 | LL | *(a as *const _ as *mut String) += " world";
|
23 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
24 | 20 |
|
25 | 21 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
26 |
| - --> $DIR/reference_casting.rs:26:25 |
| 22 | + --> $DIR/reference_casting.rs:25:25 |
27 | 23 | |
|
28 | 24 | LL | let _num = &mut *(num as *const i32 as *mut i32);
|
29 | 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
30 | 26 |
|
31 | 27 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
32 |
| - --> $DIR/reference_casting.rs:28:25 |
| 28 | + --> $DIR/reference_casting.rs:27:25 |
33 | 29 | |
|
34 | 30 | LL | let _num = &mut *(num as *const i32).cast_mut();
|
35 | 31 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
36 | 32 |
|
37 | 33 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
38 |
| - --> $DIR/reference_casting.rs:30:20 |
| 34 | + --> $DIR/reference_casting.rs:29:20 |
39 | 35 | |
|
40 | 36 | LL | let _num = *{ num as *const i32 }.cast_mut();
|
41 | 37 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
42 | 38 |
|
43 | 39 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
44 |
| - --> $DIR/reference_casting.rs:32:9 |
| 40 | + --> $DIR/reference_casting.rs:31:9 |
45 | 41 | |
|
46 | 42 | LL | *std::ptr::from_ref(num).cast_mut() += 1;
|
47 | 43 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
48 | 44 |
|
49 | 45 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
50 |
| - --> $DIR/reference_casting.rs:34:9 |
| 46 | + --> $DIR/reference_casting.rs:33:9 |
51 | 47 | |
|
52 | 48 | LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
|
53 | 49 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
54 | 50 |
|
55 | 51 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
56 |
| - --> $DIR/reference_casting.rs:36:9 |
| 52 | + --> $DIR/reference_casting.rs:35:9 |
57 | 53 | |
|
58 | 54 | LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
|
59 | 55 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
60 | 56 |
|
61 | 57 | error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
|
62 |
| - --> $DIR/reference_casting.rs:38:9 |
| 58 | + --> $DIR/reference_casting.rs:37:9 |
63 | 59 | |
|
64 | 60 | LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
|
65 | 61 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
0 commit comments