-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add generic way of converting the item type of a container #184
base: main
Are you sure you want to change the base?
Conversation
CI failed on the 1.34 version. This whole deal would have to go behind a cargo feature, given the crate's MSRV. Then we can have that feature enabled only for the "stable" and later CI runs. That said, I'm extremely intrigued by this proposal. I was initially skeptical how you'd have it handle the difference between owned containers and borrowed containers, but that seems to be captured by the pair of "CastPtr" and "CastMetadata". I'm going to link this in the |
Ideally There difference between owned and borrowed containers is handled by the
I'm going to work on getting |
Wow! Great concept here! My old draft PR #134 was similar but only handled private API and didn't go this in-depth, but could still perhaps be useful to look at.
Currently the Minor naming nit: In the rest of Since the
(Edit: actually, I guess the alignment check could just be put in
Edit 2: Actually, perhaps the GATs could just have |
Ended up rewriting this. There's no longer a separation between casting the data and the metadata. It didn't really help with anything and added the complication of splitting and combining it in the first place. It's now been replaced with a single The interface has been changed into a falliable/infalliable version. The infalliable version handles only the cases which can't fail and the falliable version handles all casts. This differs from how the current split works, but it's matches how GAT's are no longer required, lowering the msrv to 1.57 (required for The following types are now supported: |
By the sounds of the tracking issue it's likely to be the case that the bound can be relaxed. Still better to wait for that to be resolved. |
Should be the last big change. Added a This also adds Still need tests for |
I'm happy to see this making interesting progress, though I'll admit I haven't looked closely at the details yet. |
Fun thing about
|
ah. Probably this will get worse and worse with time, and rustc will have like.. |
Figured out how to make this work. An undocumented The tests need to run as a separate crate in the same workspace. |
7908e64
to
e09696a
Compare
* `Reinterpret` * `TryReinterpret` * `ReinterpretInner` * `TryReinterpretInner`
Should be in a working state now. A Some more changes have been done to make sure the error message points to the call to |
are we ready to transition into the review phase? |
I'll try to fix the error message for using
For reference the error message for
|
...once again the "note" on an error message is way too much until it's anti-helpful. But sure, if you think you can somehow adjust it to make the error messages better please do. |
This is capable of replacing all the
cast_*
functions except thecast
itself. No more need forcast_ref
,cast_slice
cast_box
,cast_vec
and such and any mutable variants. Also moves some errors to post-mono compiler errors rather than runtime errors.This is not implementable with GAT's, so this has an msrv of
1.65
.Docs and testing still need to be done, as well as implementing all the containers in
alloc
.fixes #133
fixes #167
fixes #136