@@ -286,7 +286,27 @@ LL | *value = 1;
286
286
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
287
287
288
288
error: 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
290
310
|
291
311
LL | let value = num as *const i32 as *mut i32;
292
312
| ----------------------------- casting happend here
@@ -297,23 +317,23 @@ LL | *value_rebind = 1;
297
317
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
298
318
299
319
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
300
- --> $DIR/reference_casting.rs:122 :5
320
+ --> $DIR/reference_casting.rs:129 :5
301
321
|
302
322
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
303
323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
304
324
|
305
325
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
306
326
307
327
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
308
- --> $DIR/reference_casting.rs:124 :5
328
+ --> $DIR/reference_casting.rs:131 :5
309
329
|
310
330
LL | *(num as *const _ as usize as *mut i32) = 2;
311
331
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
312
332
|
313
333
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
314
334
315
335
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
316
- --> $DIR/reference_casting.rs:126 :5
336
+ --> $DIR/reference_casting.rs:133 :5
317
337
|
318
338
LL | let value = num as *const i32 as *mut i32;
319
339
| ----------------------------- casting happend here
@@ -324,7 +344,7 @@ LL | std::ptr::write(value, 2);
324
344
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
325
345
326
346
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
327
- --> $DIR/reference_casting.rs:128 :5
347
+ --> $DIR/reference_casting.rs:135 :5
328
348
|
329
349
LL | let value = num as *const i32 as *mut i32;
330
350
| ----------------------------- casting happend here
@@ -335,7 +355,7 @@ LL | std::ptr::write_unaligned(value, 2);
335
355
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
336
356
337
357
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
338
- --> $DIR/reference_casting.rs:130 :5
358
+ --> $DIR/reference_casting.rs:137 :5
339
359
|
340
360
LL | let value = num as *const i32 as *mut i32;
341
361
| ----------------------------- casting happend here
@@ -346,12 +366,12 @@ LL | std::ptr::write_volatile(value, 2);
346
366
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
347
367
348
368
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
349
- --> $DIR/reference_casting.rs:134 :9
369
+ --> $DIR/reference_casting.rs:141 :9
350
370
|
351
371
LL | *(this as *const _ as *mut _) = a;
352
372
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
353
373
|
354
374
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
355
375
356
- error: aborting due to 40 previous errors
376
+ error: aborting due to 42 previous errors
357
377
0 commit comments