Skip to content

Commit 6a79628

Browse files
committed
fix: replace core::ptr::{raw_const → addr_of, raw_mut → addr_of_mut}
These former-unstable macros were renamed before stabilization.
1 parent 11b370c commit 6a79628

File tree

5 files changed

+68
-68
lines changed

5 files changed

+68
-68
lines changed

src/r3/src/sync/recursive_mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<System: Kernel, T: 'static> RecursiveMutex<System, T> {
320320
/// Get a raw pointer to the contained data.
321321
#[inline]
322322
pub fn get_ptr(&self) -> *mut T {
323-
core::ptr::raw_const!(self.hunk.data) as _
323+
core::ptr::addr_of!(self.hunk.data) as _
324324
}
325325
}
326326

src/r3_port_arm/src/sp804/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ macro_rules! use_sp804 {
9393
type TicklessState = tickless::TicklessState<TICKLESS_CFG>;
9494

9595
fn tickless_state() -> *mut Self::TicklessState {
96-
// FIXME: Use `core::ptr::raw_mut!` when it's stable
96+
// FIXME: Use `core::ptr::addr_of_mut!` when it's stable
9797
unsafe { &mut TIMER_STATE }
9898
}
9999
}

src/r3_port_riscv/src/timer/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ macro_rules! use_timer {
9797
type TicklessState = tickless::TicklessState<TICKLESS_CFG>;
9898

9999
fn tickless_state() -> *mut Self::TicklessState {
100-
// FIXME: Use `core::ptr::raw_mut!` when it's stable
100+
// FIXME: Use `core::ptr::addr_of_mut!` when it's stable
101101
unsafe { &mut TIMER_STATE }
102102
}
103103
}

src/r3_port_riscv_test_driver/src/driver_kernel_tests/execute_lr_sc.rs

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Executes LR and SC instructions with various parameters. This test will
22
//! exercise the emulation code (`emulate-lr-sc`) on some targets.
3-
use core::{marker::PhantomData, mem::MaybeUninit, ptr::raw_mut};
3+
use core::{marker::PhantomData, mem::MaybeUninit, ptr::addr_of_mut};
44
use r3::{
55
kernel::{cfg::CfgBuilder, StartupHook, Task},
66
prelude::*,
@@ -272,127 +272,127 @@ unsafe fn do_test<System: Kernel>() {
272272
// `lr.w _, (x6)`
273273
// ------------------------------------------------------------------
274274
exec!("la x6, {VAR}; lr.w x0, (x6)", |st| {
275-
st.x[6] = raw_mut!(VAR) as _;
275+
st.x[6] = addr_of_mut!(VAR) as _;
276276
});
277277
exec!("la x6, {VAR}; lr.w x1, (x6)", |st| {
278-
st.x[6] = raw_mut!(VAR) as _;
278+
st.x[6] = addr_of_mut!(VAR) as _;
279279
st.x[1] = VAR_SEXT;
280280
});
281281
// `lr.w sp, (_)` is not supported by this test harness nor
282282
// `emulate-lr-sc`.
283283
exec!("la x6, {VAR}; lr.w x3, (x6)", |st| {
284-
st.x[6] = raw_mut!(VAR) as _;
284+
st.x[6] = addr_of_mut!(VAR) as _;
285285
st.x[3] = VAR_SEXT;
286286
});
287287
exec!("la x6, {VAR}; lr.w x4, (x6)", |st| {
288-
st.x[6] = raw_mut!(VAR) as _;
288+
st.x[6] = addr_of_mut!(VAR) as _;
289289
st.x[4] = VAR_SEXT;
290290
});
291291
exec!("la x6, {VAR}; lr.w x5, (x6)", |st| {
292-
st.x[6] = raw_mut!(VAR) as _;
292+
st.x[6] = addr_of_mut!(VAR) as _;
293293
st.x[5] = VAR_SEXT;
294294
});
295295
exec!("la x6, {VAR}; lr.w x6, (x6)", |st| {
296296
st.x[6] = VAR_SEXT;
297297
});
298298
exec!("la x6, {VAR}; lr.w x7, (x6)", |st| {
299-
st.x[6] = raw_mut!(VAR) as _;
299+
st.x[6] = addr_of_mut!(VAR) as _;
300300
st.x[7] = VAR_SEXT;
301301
});
302302
exec!("la x6, {VAR}; lr.w x8, (x6)", |st| {
303-
st.x[6] = raw_mut!(VAR) as _;
303+
st.x[6] = addr_of_mut!(VAR) as _;
304304
st.x[8] = VAR_SEXT;
305305
});
306306
exec!("la x6, {VAR}; lr.w x9, (x6)", |st| {
307-
st.x[6] = raw_mut!(VAR) as _;
307+
st.x[6] = addr_of_mut!(VAR) as _;
308308
st.x[9] = VAR_SEXT;
309309
});
310310
exec!("la x6, {VAR}; lr.w x10, (x6)", |st| {
311-
st.x[6] = raw_mut!(VAR) as _;
311+
st.x[6] = addr_of_mut!(VAR) as _;
312312
st.x[10] = VAR_SEXT;
313313
});
314314
exec!("la x6, {VAR}; lr.w x11, (x6)", |st| {
315-
st.x[6] = raw_mut!(VAR) as _;
315+
st.x[6] = addr_of_mut!(VAR) as _;
316316
st.x[11] = VAR_SEXT;
317317
});
318318
exec!("la x6, {VAR}; lr.w x12, (x6)", |st| {
319-
st.x[6] = raw_mut!(VAR) as _;
319+
st.x[6] = addr_of_mut!(VAR) as _;
320320
st.x[12] = VAR_SEXT;
321321
});
322322
exec!("la x6, {VAR}; lr.w x13, (x6)", |st| {
323-
st.x[6] = raw_mut!(VAR) as _;
323+
st.x[6] = addr_of_mut!(VAR) as _;
324324
st.x[13] = VAR_SEXT;
325325
});
326326
exec!("la x6, {VAR}; lr.w x14, (x6)", |st| {
327-
st.x[6] = raw_mut!(VAR) as _;
327+
st.x[6] = addr_of_mut!(VAR) as _;
328328
st.x[14] = VAR_SEXT;
329329
});
330330
exec!("la x6, {VAR}; lr.w x15, (x6)", |st| {
331-
st.x[6] = raw_mut!(VAR) as _;
331+
st.x[6] = addr_of_mut!(VAR) as _;
332332
st.x[15] = VAR_SEXT;
333333
});
334334
exec!("la x6, {VAR}; lr.w x16, (x6)", |st| {
335-
st.x[6] = raw_mut!(VAR) as _;
335+
st.x[6] = addr_of_mut!(VAR) as _;
336336
st.x[16] = VAR_SEXT;
337337
});
338338
exec!("la x6, {VAR}; lr.w x17, (x6)", |st| {
339-
st.x[6] = raw_mut!(VAR) as _;
339+
st.x[6] = addr_of_mut!(VAR) as _;
340340
st.x[17] = VAR_SEXT;
341341
});
342342
exec!("la x6, {VAR}; lr.w x18, (x6)", |st| {
343-
st.x[6] = raw_mut!(VAR) as _;
343+
st.x[6] = addr_of_mut!(VAR) as _;
344344
st.x[18] = VAR_SEXT;
345345
});
346346
exec!("la x6, {VAR}; lr.w x19, (x6)", |st| {
347-
st.x[6] = raw_mut!(VAR) as _;
347+
st.x[6] = addr_of_mut!(VAR) as _;
348348
st.x[19] = VAR_SEXT;
349349
});
350350
exec!("la x6, {VAR}; lr.w x20, (x6)", |st| {
351-
st.x[6] = raw_mut!(VAR) as _;
351+
st.x[6] = addr_of_mut!(VAR) as _;
352352
st.x[20] = VAR_SEXT;
353353
});
354354
exec!("la x6, {VAR}; lr.w x21, (x6)", |st| {
355-
st.x[6] = raw_mut!(VAR) as _;
355+
st.x[6] = addr_of_mut!(VAR) as _;
356356
st.x[21] = VAR_SEXT;
357357
});
358358
exec!("la x6, {VAR}; lr.w x22, (x6)", |st| {
359-
st.x[6] = raw_mut!(VAR) as _;
359+
st.x[6] = addr_of_mut!(VAR) as _;
360360
st.x[22] = VAR_SEXT;
361361
});
362362
exec!("la x6, {VAR}; lr.w x23, (x6)", |st| {
363-
st.x[6] = raw_mut!(VAR) as _;
363+
st.x[6] = addr_of_mut!(VAR) as _;
364364
st.x[23] = VAR_SEXT;
365365
});
366366
exec!("la x6, {VAR}; lr.w x24, (x6)", |st| {
367-
st.x[6] = raw_mut!(VAR) as _;
367+
st.x[6] = addr_of_mut!(VAR) as _;
368368
st.x[24] = VAR_SEXT;
369369
});
370370
exec!("la x6, {VAR}; lr.w x25, (x6)", |st| {
371-
st.x[6] = raw_mut!(VAR) as _;
371+
st.x[6] = addr_of_mut!(VAR) as _;
372372
st.x[25] = VAR_SEXT;
373373
});
374374
exec!("la x6, {VAR}; lr.w x26, (x6)", |st| {
375-
st.x[6] = raw_mut!(VAR) as _;
375+
st.x[6] = addr_of_mut!(VAR) as _;
376376
st.x[26] = VAR_SEXT;
377377
});
378378
exec!("la x6, {VAR}; lr.w x27, (x6)", |st| {
379-
st.x[6] = raw_mut!(VAR) as _;
379+
st.x[6] = addr_of_mut!(VAR) as _;
380380
st.x[27] = VAR_SEXT;
381381
});
382382
exec!("la x6, {VAR}; lr.w x28, (x6)", |st| {
383-
st.x[6] = raw_mut!(VAR) as _;
383+
st.x[6] = addr_of_mut!(VAR) as _;
384384
st.x[28] = VAR_SEXT;
385385
});
386386
exec!("la x6, {VAR}; lr.w x29, (x6)", |st| {
387-
st.x[6] = raw_mut!(VAR) as _;
387+
st.x[6] = addr_of_mut!(VAR) as _;
388388
st.x[29] = VAR_SEXT;
389389
});
390390
exec!("la x6, {VAR}; lr.w x30, (x6)", |st| {
391-
st.x[6] = raw_mut!(VAR) as _;
391+
st.x[6] = addr_of_mut!(VAR) as _;
392392
st.x[30] = VAR_SEXT;
393393
});
394394
exec!("la x6, {VAR}; lr.w x31, (x6)", |st| {
395-
st.x[6] = raw_mut!(VAR) as _;
395+
st.x[6] = addr_of_mut!(VAR) as _;
396396
st.x[31] = VAR_SEXT;
397397
});
398398

@@ -402,7 +402,7 @@ unsafe fn do_test<System: Kernel>() {
402402
// `lr.w _, (x0)` will never succeed unless there's valid data at `0`
403403

404404
exec!("la x1, {VAR}; lr.w x6, (x1)", |st| {
405-
st.x[1] = raw_mut!(VAR) as _;
405+
st.x[1] = addr_of_mut!(VAR) as _;
406406
st.x[6] = VAR_SEXT;
407407
});
408408

@@ -419,119 +419,119 @@ unsafe fn do_test<System: Kernel>() {
419419
);
420420

421421
exec!("la x3, {VAR}; lr.w x6, (x3)", |st| {
422-
st.x[3] = raw_mut!(VAR) as _;
422+
st.x[3] = addr_of_mut!(VAR) as _;
423423
st.x[6] = VAR_SEXT;
424424
});
425425
exec!("la x4, {VAR}; lr.w x6, (x4)", |st| {
426-
st.x[4] = raw_mut!(VAR) as _;
426+
st.x[4] = addr_of_mut!(VAR) as _;
427427
st.x[6] = VAR_SEXT;
428428
});
429429
exec!("la x5, {VAR}; lr.w x6, (x5)", |st| {
430-
st.x[5] = raw_mut!(VAR) as _;
430+
st.x[5] = addr_of_mut!(VAR) as _;
431431
st.x[6] = VAR_SEXT;
432432
});
433433
exec!("la x6, {VAR}; lr.w x7, (x6)", |st| {
434-
st.x[6] = raw_mut!(VAR) as _;
434+
st.x[6] = addr_of_mut!(VAR) as _;
435435
st.x[7] = VAR_SEXT;
436436
});
437437
exec!("la x7, {VAR}; lr.w x6, (x7)", |st| {
438-
st.x[7] = raw_mut!(VAR) as _;
438+
st.x[7] = addr_of_mut!(VAR) as _;
439439
st.x[6] = VAR_SEXT;
440440
});
441441
exec!("la x8, {VAR}; lr.w x6, (x8)", |st| {
442-
st.x[8] = raw_mut!(VAR) as _;
442+
st.x[8] = addr_of_mut!(VAR) as _;
443443
st.x[6] = VAR_SEXT;
444444
});
445445
exec!("la x9, {VAR}; lr.w x6, (x9)", |st| {
446-
st.x[9] = raw_mut!(VAR) as _;
446+
st.x[9] = addr_of_mut!(VAR) as _;
447447
st.x[6] = VAR_SEXT;
448448
});
449449
exec!("la x10, {VAR}; lr.w x6, (x10)", |st| {
450-
st.x[10] = raw_mut!(VAR) as _;
450+
st.x[10] = addr_of_mut!(VAR) as _;
451451
st.x[6] = VAR_SEXT;
452452
});
453453
exec!("la x11, {VAR}; lr.w x6, (x11)", |st| {
454-
st.x[11] = raw_mut!(VAR) as _;
454+
st.x[11] = addr_of_mut!(VAR) as _;
455455
st.x[6] = VAR_SEXT;
456456
});
457457
exec!("la x12, {VAR}; lr.w x6, (x12)", |st| {
458-
st.x[12] = raw_mut!(VAR) as _;
458+
st.x[12] = addr_of_mut!(VAR) as _;
459459
st.x[6] = VAR_SEXT;
460460
});
461461
exec!("la x13, {VAR}; lr.w x6, (x13)", |st| {
462-
st.x[13] = raw_mut!(VAR) as _;
462+
st.x[13] = addr_of_mut!(VAR) as _;
463463
st.x[6] = VAR_SEXT;
464464
});
465465
exec!("la x14, {VAR}; lr.w x6, (x14)", |st| {
466-
st.x[14] = raw_mut!(VAR) as _;
466+
st.x[14] = addr_of_mut!(VAR) as _;
467467
st.x[6] = VAR_SEXT;
468468
});
469469
exec!("la x15, {VAR}; lr.w x6, (x15)", |st| {
470-
st.x[15] = raw_mut!(VAR) as _;
470+
st.x[15] = addr_of_mut!(VAR) as _;
471471
st.x[6] = VAR_SEXT;
472472
});
473473
exec!("la x16, {VAR}; lr.w x6, (x16)", |st| {
474-
st.x[16] = raw_mut!(VAR) as _;
474+
st.x[16] = addr_of_mut!(VAR) as _;
475475
st.x[6] = VAR_SEXT;
476476
});
477477
exec!("la x17, {VAR}; lr.w x6, (x17)", |st| {
478-
st.x[17] = raw_mut!(VAR) as _;
478+
st.x[17] = addr_of_mut!(VAR) as _;
479479
st.x[6] = VAR_SEXT;
480480
});
481481
exec!("la x18, {VAR}; lr.w x6, (x18)", |st| {
482-
st.x[18] = raw_mut!(VAR) as _;
482+
st.x[18] = addr_of_mut!(VAR) as _;
483483
st.x[6] = VAR_SEXT;
484484
});
485485
exec!("la x19, {VAR}; lr.w x6, (x19)", |st| {
486-
st.x[19] = raw_mut!(VAR) as _;
486+
st.x[19] = addr_of_mut!(VAR) as _;
487487
st.x[6] = VAR_SEXT;
488488
});
489489
exec!("la x20, {VAR}; lr.w x6, (x20)", |st| {
490-
st.x[20] = raw_mut!(VAR) as _;
490+
st.x[20] = addr_of_mut!(VAR) as _;
491491
st.x[6] = VAR_SEXT;
492492
});
493493
exec!("la x21, {VAR}; lr.w x6, (x21)", |st| {
494-
st.x[21] = raw_mut!(VAR) as _;
494+
st.x[21] = addr_of_mut!(VAR) as _;
495495
st.x[6] = VAR_SEXT;
496496
});
497497
exec!("la x22, {VAR}; lr.w x6, (x22)", |st| {
498-
st.x[22] = raw_mut!(VAR) as _;
498+
st.x[22] = addr_of_mut!(VAR) as _;
499499
st.x[6] = VAR_SEXT;
500500
});
501501
exec!("la x23, {VAR}; lr.w x6, (x23)", |st| {
502-
st.x[23] = raw_mut!(VAR) as _;
502+
st.x[23] = addr_of_mut!(VAR) as _;
503503
st.x[6] = VAR_SEXT;
504504
});
505505
exec!("la x24, {VAR}; lr.w x6, (x24)", |st| {
506-
st.x[24] = raw_mut!(VAR) as _;
506+
st.x[24] = addr_of_mut!(VAR) as _;
507507
st.x[6] = VAR_SEXT;
508508
});
509509
exec!("la x25, {VAR}; lr.w x6, (x25)", |st| {
510-
st.x[25] = raw_mut!(VAR) as _;
510+
st.x[25] = addr_of_mut!(VAR) as _;
511511
st.x[6] = VAR_SEXT;
512512
});
513513
exec!("la x26, {VAR}; lr.w x6, (x26)", |st| {
514-
st.x[26] = raw_mut!(VAR) as _;
514+
st.x[26] = addr_of_mut!(VAR) as _;
515515
st.x[6] = VAR_SEXT;
516516
});
517517
exec!("la x27, {VAR}; lr.w x6, (x27)", |st| {
518-
st.x[27] = raw_mut!(VAR) as _;
518+
st.x[27] = addr_of_mut!(VAR) as _;
519519
st.x[6] = VAR_SEXT;
520520
});
521521
exec!("la x28, {VAR}; lr.w x6, (x28)", |st| {
522-
st.x[28] = raw_mut!(VAR) as _;
522+
st.x[28] = addr_of_mut!(VAR) as _;
523523
st.x[6] = VAR_SEXT;
524524
});
525525
exec!("la x29, {VAR}; lr.w x6, (x29)", |st| {
526-
st.x[29] = raw_mut!(VAR) as _;
526+
st.x[29] = addr_of_mut!(VAR) as _;
527527
st.x[6] = VAR_SEXT;
528528
});
529529
exec!("la x30, {VAR}; lr.w x6, (x30)", |st| {
530-
st.x[30] = raw_mut!(VAR) as _;
530+
st.x[30] = addr_of_mut!(VAR) as _;
531531
st.x[6] = VAR_SEXT;
532532
});
533533
exec!("la x31, {VAR}; lr.w x6, (x31)", |st| {
534-
st.x[31] = raw_mut!(VAR) as _;
534+
st.x[31] = addr_of_mut!(VAR) as _;
535535
st.x[6] = VAR_SEXT;
536536
});
537537

@@ -543,7 +543,7 @@ unsafe fn do_test<System: Kernel>() {
543543
addi x6, x6, 1
544544
sc.w x8, x6, (x7)",
545545
|st| {
546-
st.x[7] = raw_mut!(VAR) as _;
546+
st.x[7] = addr_of_mut!(VAR) as _;
547547
st.x[6] = VAR_SEXT.wrapping_add(1);
548548
st.x[8] = 0 as _; // success
549549
}
@@ -557,7 +557,7 @@ unsafe fn do_test<System: Kernel>() {
557557
sc.w x8, x0, (x7)
558558
snez x8, x8",
559559
|st| {
560-
st.x[7] = raw_mut!(VAR) as _;
560+
st.x[7] = addr_of_mut!(VAR) as _;
561561
st.x[6] = VAR_SEXT;
562562
st.x[8] = 1 as _; // non-zero result value, meaning failure
563563
}
@@ -570,7 +570,7 @@ unsafe fn do_test<System: Kernel>() {
570570
sc.w x8, x6, (x7)
571571
snez x8, x8",
572572
|st| {
573-
st.x[7] = raw_mut!(VAR) as _;
573+
st.x[7] = addr_of_mut!(VAR) as _;
574574
st.x[6] = VAR_SEXT;
575575
st.x[8] = 1 as _; // non-zero result value, meaning failure
576576
}

src/r3_support_rza1/src/os_timer/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ macro_rules! use_os_timer {
9292
type TicklessState = tickless::TicklessState<TICKLESS_CFG>;
9393

9494
fn tickless_state() -> *mut Self::TicklessState {
95-
// FIXME: Use `core::ptr::raw_mut!` when it's stable
95+
// FIXME: Use `core::ptr::addr_of_mut!` when it's stable
9696
unsafe { &mut TIMER_STATE }
9797
}
9898
}

0 commit comments

Comments
 (0)