Skip to content

Feat: genericize ptr::from_raw_parts #5

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

Closed

Conversation

stegaBOB
Copy link

Realigns with the latest RFC changes. rust-lang/rust#125701

@djkoloski
Copy link
Collaborator

I'd be happy to add the backwards-compatible Thin trait, but I'd prefer not to update from_raw_parts yet. I don't think it provides a significant enough ergonomics or functionality improvement to justify the semver breakage. I consider this the "stable" part of "radioactive stabilization".

Many of the choices around these APIs have not yet been thoroughly debated because the ptr_meta RFC is still unstable. Despite this crate being (approximately) a stabilization of the ptr_meta RFC, it already deviates from it in a few places. For example, there's no way to provide builtin methods on pointers and NonNull. A previous version of ptr_meta provided extension traits to almost get there, but in the end it triggered too many clippy lints and was generally a bad experience. Hopefully this helps explain my position a little bit better.

I think that if we get a good reason to release a new breaking version of this crate in the future, we should seize the opportunity and also update from_raw_parts to accept *mut impl Thin.

@stegaBOB
Copy link
Author

Totally understand. We just stumbled on this crate while trying to get rid of all our nightly features and I noticed the slight difference and thought I'd quickly toss this PR up. And yep like you said the difference is so small that it isn't worth the breaking change if you aren't trying to keep this 1:1. Closing for now :)

@stegaBOB stegaBOB closed this Apr 14, 2025
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