Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c: AddressMode: add bound Copy #634

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

spikespaz
Copy link
Contributor

@spikespaz spikespaz commented Oct 7, 2024

Since the trait AddressMode is Sealed, and only implemented on Copy types (u8 and u16), there isn't any reason for the trait not to be bound also as Copy. This makes multiple-consumption much easier, and does not require calling code to add extra bounds.

@spikespaz spikespaz requested a review from a team as a code owner October 7, 2024 20:31
@jannic
Copy link
Member

jannic commented Oct 10, 2024

We had some discussion about this on Monday in the matrix room: https://libera.irclog.whitequark.org/rust-embedded/2024-10-07#1728335635-1728335961;

Adding Copy is, at least technically, a breaking change. Example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=705af2100f5461aa539eaddb2321bfe4

However we didn't find any realistic situation where one would write code that would be affected.

There was no conclusion if this should be merged (ignoring the breaking change), or deferred for the next major version.

@spikespaz
Copy link
Contributor Author

We agree that this is a breaking change and not a major one. It might fall under the "additive" category. Isn't there a tool that is used to check how many crates would be broken by small changes like this?

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

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

LGTM.

As commented above and discussed in last's week meeting, this is technically breaking but is unlikely to be hit by anyone, since it affects dyn AddressMode and there was no way to do anything useful with it anyway.

I'll wait until meeting on next Tuesday to merge in case another HAL team member wants to raise a concern.

Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

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

LGTM, too

@Dirbaio Dirbaio added this pull request to the merge queue Oct 15, 2024
Merged via the queue into rust-embedded:master with commit 14b1765 Oct 15, 2024
7 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.

4 participants