@@ -286,7 +286,27 @@ LL | *value = 1;
286286 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
287287
288288error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
289- --> $DIR/reference_casting.rs:120:5
289+ --> $DIR/reference_casting.rs:121:5
290+ |
291+ LL | let value = value as *mut i32;
292+ | ----------------- casting happend here
293+ LL | *value = 1;
294+ | ^^^^^^^^^^
295+ |
296+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
297+
298+ error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
299+ --> $DIR/reference_casting.rs:124:5
300+ |
301+ LL | let value = num as *const i32 as *mut i32;
302+ | ----------------------------- casting happend here
303+ LL | *value = 1;
304+ | ^^^^^^^^^^
305+ |
306+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
307+
308+ error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
309+ --> $DIR/reference_casting.rs:127:5
290310 |
291311LL | let value = num as *const i32 as *mut i32;
292312 | ----------------------------- casting happend here
@@ -297,23 +317,23 @@ LL | *value_rebind = 1;
297317 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
298318
299319error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
300- --> $DIR/reference_casting.rs:122 :5
320+ --> $DIR/reference_casting.rs:129 :5
301321 |
302322LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
303323 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
304324 |
305325 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
306326
307327error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
308- --> $DIR/reference_casting.rs:124 :5
328+ --> $DIR/reference_casting.rs:131 :5
309329 |
310330LL | *(num as *const _ as usize as *mut i32) = 2;
311331 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
312332 |
313333 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
314334
315335error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
316- --> $DIR/reference_casting.rs:126 :5
336+ --> $DIR/reference_casting.rs:133 :5
317337 |
318338LL | let value = num as *const i32 as *mut i32;
319339 | ----------------------------- casting happend here
@@ -324,7 +344,7 @@ LL | std::ptr::write(value, 2);
324344 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
325345
326346error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
327- --> $DIR/reference_casting.rs:128 :5
347+ --> $DIR/reference_casting.rs:135 :5
328348 |
329349LL | let value = num as *const i32 as *mut i32;
330350 | ----------------------------- casting happend here
@@ -335,7 +355,7 @@ LL | std::ptr::write_unaligned(value, 2);
335355 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
336356
337357error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
338- --> $DIR/reference_casting.rs:130 :5
358+ --> $DIR/reference_casting.rs:137 :5
339359 |
340360LL | let value = num as *const i32 as *mut i32;
341361 | ----------------------------- casting happend here
@@ -346,12 +366,12 @@ LL | std::ptr::write_volatile(value, 2);
346366 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
347367
348368error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
349- --> $DIR/reference_casting.rs:134 :9
369+ --> $DIR/reference_casting.rs:141 :9
350370 |
351371LL | *(this as *const _ as *mut _) = a;
352372 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
353373 |
354374 = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
355375
356- error: aborting due to 40 previous errors
376+ error: aborting due to 42 previous errors
357377
0 commit comments