Conversation
|
Hah, shame we can't add an impl of bare_metal's Nr to cortex-m-types. Can we keep using cortex-m's old InterruptNumber trait in NVIC, and add an impl of InterruptNumber for anything implementing either bare_metal's Nr or cortex-m-type's InterruptNumber? |
|
maybe, but I do not know how with my current Rust foo. I get conflicting implementation errors when I try do add a blanket impl for both of these types. The fundamental problem probably is that this is a breaking change, right? At this point I wonder whether we just have to accept some transition pain and move forward with the breaking change. then I have to merge into a different branch. At the very least, PACs will not break anymore in the future, as long as everybody agrees on the same trait crate, right? |
|
do we have a branch for breaking changes? drafted until it is decided how to continue.. |
|
I think the current CI failure is fixed by #653 |
a64de05 to
1992346
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the cortex-m crate’s NVIC APIs to use the cortex-m-types InterruptNumber trait, and adjusts the legacy cortex_m::interrupt::InterruptNumber to be a deprecated compatibility layer over the new trait.
Changes:
- Switch
NVICmethods to acceptcortex_m_types::InterruptNumberinstead ofcortex_m::interrupt::InterruptNumber. - Deprecate
cortex_m::interrupt::InterruptNumberand provide a blanket impl forcortex_m_types::InterruptNumber. - Add a new dependency on the in-repo
cortex-m-typescrate.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
cortex-m/src/peripheral/nvic.rs |
Replaces the interrupt-number trait bound used by NVIC APIs and updates conversions/indexing accordingly. |
cortex-m/src/interrupt.rs |
Deprecates the legacy trait and changes the compatibility blanket impl to target cortex_m_types::InterruptNumber. |
cortex-m/Cargo.toml |
Adds cortex-m-types as a dependency to support the new NVIC/interrupt trait usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
168018f to
e827f54
Compare
The InterruptNumber blanket impl for
cortex_m_types::InterruptNumberis not compatible with the one for all types implementing bare_metal::Nr . removing the other blanket impl is probably a breaking change? :/