Skip to content

Conversation

@jannic
Copy link
Member

@jannic jannic commented Dec 3, 2025

Current nightly warns about direct casts from function to integer:

warning: direct cast of function item into an integer
   --> .../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.

Current nightly warns about direct casts from function to integer:
```
warning: direct cast of function item into an integer
   --> .../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.
Copy link
Member

@9names 9names left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Not sure why the cargo hack CI step failed, looks like just a spurious network error?

@jannic
Copy link
Member Author

jannic commented Dec 3, 2025

Very likely yes. I tried it locally, I do get valid gzip compressed data from curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz.

@jannic jannic merged commit 50a7782 into main Dec 3, 2025
97 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants