Skip to content

Commit d86aff3

Browse files
committed
Avoid direct casts from function to integer
Current nightly warns about direct casts from function to integer: ``` warning: direct cast of function item into an integer --> /home/jan/rp-rs/rp-hal/rp235x-hal/src/multicore.rs:371:36 | 371 | core1_startup::<F> as usize, | ^^^^^^^^ | = note: `#[warn(function_casts_as_integer)]` on by default help: first cast to a pointer `as *const ()` | 371 | core1_startup::<F> as *const () as usize, | ++++++++++++ ``` In our case the cast is intended, so apply the suggested fix. As an alternative to `*const ()` for the intermediate step, one could also use the actual fn type. However, in this case, that would be a rather long signature: `core1_startup::<F> as extern "C" fn(u64, u64, *mut core::mem::ManuallyDrop<F>, *mut usize) -> ! as usize` So I think here it's better to use the `*const ()` shortcut.
1 parent 28fdf0c commit d86aff3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rp2040-hal/src/multicore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl Core<'_> {
348348
1,
349349
vector_table as usize,
350350
stack_ptr as usize,
351-
core1_startup::<F> as usize,
351+
core1_startup::<F> as *const () as usize,
352352
];
353353

354354
let mut seq = 0;

rp235x-hal/src/multicore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl Core<'_> {
368368
1,
369369
vector_table as usize,
370370
stack_ptr as usize,
371-
core1_startup::<F> as usize,
371+
core1_startup::<F> as *const () as usize,
372372
];
373373

374374
let mut seq = 0;

0 commit comments

Comments
 (0)