Update slice DST ops, use &raw mut, and improve documentation#128
Update slice DST ops, use &raw mut, and improve documentation#128Manishearth merged 4 commits intoManishearth:masterfrom
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) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
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.