-
Notifications
You must be signed in to change notification settings - Fork 60
Update slice DST ops, use &raw mut, and improve documentation #128
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
Update slice DST ops, use &raw mut, and improve documentation #128
Conversation
|
(I do plan to look at this, I'm on vacation and have a large pile of stuff to handle when I get back) |
Manishearth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes pointer handling in DST (dynamically sized type) operations by adopting &raw mut syntax, removes unnecessary ZST panics, consolidates allocation logic, and enhances documentation for safer and clearer code.
Changes:
- Replaced intermediate reference creation with
&raw mutpointer operations to avoid potential UB - Removed unnecessary panics for zero-sized types and added logic to handle them correctly
- Consolidated Arc allocation logic and added explicit panic messages for oversized layouts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/header.rs | Updated pointer operations to use &raw mut, removed ZST assertions, improved documentation with panic conditions |
| src/arc.rs | Consolidated allocation functions, replaced unwrap calls with expect messages, enhanced safety documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/arc.rs
Outdated
| .pad_to_align(); | ||
|
|
||
| // ArcInner never has a zero size | ||
| let ptr = alloc::alloc::alloc(full_layout); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra whitespace between '=' and 'alloc'. Should be single space.
| let ptr = alloc::alloc::alloc(full_layout); | |
| let ptr = alloc::alloc::alloc(full_layout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably do fix this.
(I should make sure this crate has rustfmt CI, but I'll do that later)
|
I am fine with updating MSRV to 1.82, updating the test, and landing this. 1.82 is a year and a half old. |
|
The So it's up to you - updating to 1.82 boils down to your preference as a maintainer. I think a more important question is, given this crate's role in the ecosystem, what do you think about releasing a version 1.0 of triomphe? Could be a good idea. |
|
CI still fails, needs to work without
shrug. I don't consider 1.0 to be a "must reach" goal for crates like this. I think this crate is basically "done", but I also do not want to have a major release just so we can clean up the number. It would be nice to at some point go through and look for potential breaking changes that would improve this crate, and then release a 1.0. |
|
Thanks! |
A few changes are bundled into this PR. It's sort of code cleanup, but it also removes some unneeded panics and adds valuable documentation.
&raw mutand stopped creating intermediate references. This is kinda UB even though it currently doesn't flag MIRI. So best to use the pointer address syntax.