Skip to content

Conversation

@mkroening
Copy link
Member

This PR makes the range types PhysFrameRange, PhysFrameRangeInclusive, PageRange, and PageRangeInclusive not derive Copy anymore.

Implementing Copy for iterators is a known footgun and should be avoided. See rust-lang/rust#48649 (comment) for details.

Once the new range types (rust-lang/rfcs#3550, rust-lang/rust#123741) are stable, we should make these types Copy again and only implement IntoIterator.

Alternatively, we switch to an IntoIterator-based approach today, without waiting for the reference in std to be stabilized.

@mkroening
Copy link
Member Author

While preparing this PR, I noticed that these types are #[repr(C)]. This is the case since 399b3d4. Is there a reason for that? If not, it might make sense to remove that in another PR. 🤔

Copy link
Member

@Freax13 Freax13 left a comment

Choose a reason for hiding this comment

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

Thanks!

Once the new range types (rust-lang/rfcs#3550, rust-lang/rust#123741) are stable, we should make these types Copy again and only implement IntoIterator.

Alternatively, we switch to an IntoIterator-based approach today, without waiting for the reference in std to be stabilized.

Let's wait for the types to be stabilized. If there are any last-minute changes to the new types, we probably also want to make these, so let's wait until they've been stabilized.

I'm hoping the Step will get stabilized eventually, so we can remove our range types entirely.

While preparing this PR, I noticed that these types are #[repr(C)]. This is the case since 399b3d4. Is there a reason for that? If not, it might make sense to remove that in another PR. 🤔

I don't think there's a reason for that. Let's remove it.

@Freax13 Freax13 merged commit a96374a into rust-osdev:next Jan 16, 2026
11 of 12 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.

2 participants