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

fix(access): properly seal access traits #59

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

mkroening
Copy link
Member

@mkroening mkroening commented Apr 25, 2024

Before, anyone could just implement Access, Readable, Copyable, and Copyable because _private() was already available as default implementation, removing the need to construct _Private (impossible because of #[non_exhaustive]).

This PR properly seals the affected traits as described in the Rust API Guidelines: Sealed traits protect against downstream implementations (C-SEALED)—Future proofing—Rust API Guidelines.

While this is a soundness issue, I don't think this is yank-worthy.

Note that _private was not hidden in the docs, so removing that would be a breaking change, strictly speaking, but I doubt that this is a problem in practice.

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

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

Good catch, thanks! I don't know why I didn't think of the consequences of a default impl...

I think the intention of keeping the traits private was still clear, so I would treat this as a bug fix instead of considering it a breaking change.

@phil-opp phil-opp merged commit e683a4f into rust-osdev:main Apr 26, 2024
5 checks passed
@mkroening mkroening deleted the sealed branch April 26, 2024 07:11
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.

None yet

2 participants