Skip to content

Conversation

@thejpster
Copy link
Contributor

@thejpster thejpster commented Dec 2, 2025

  • Be explicit about pointer casts

    Current nightly Rust now warns about function pointer casts

  • Bump nightly Rust compiler version for tests/examples

Removes compiler warning added to nightly recently. People often
accidentally cast function pointers to integers when they meant to
call the function and cast the result, but they forgot the (). So
because we actually want to cast a function pointer we have to be clear
about that.
Copy link
Member

@jannic jannic left a comment

Choose a reason for hiding this comment

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

At first I was a bit surprised that the warning emitted by rustc is different from what you added:

help: first cast to a pointer `as *const ()`
   |
71 |             addr, bkpt_from_a32 as *const () as usize
   |                                 ++++++++++++

However then I read the comments on the PR introducing this lint, and realized that *const () is just a compromise.
The original author of the lint actually preferred the variant you chose. rust-lang/rust#141470 (comment)

LGTM

@jonathanpallant jonathanpallant added this pull request to the merge queue Dec 3, 2025
Merged via the queue into rust-embedded:main with commit 027bdcf Dec 3, 2025
43 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