Teach transmute_{ref,mut}! to handle slice DSTs#1924
Closed
Conversation
11 tasks
829607d to
f1868fa
Compare
Member
Author
|
I wonder if we could use the autoref trick to get T: Sized to work. Specifically, we could provide one impl for T: Sized as the default, and then a fallback to T: KnownLayout |
Collaborator
Yes, I believe we can: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=78af21ee715df8622ed1b28433a1d314 |
Makes progress on #1009 gherrit-pr-id: I3d825b6c6b99277c96d9fd6a6761bdfad2000473
This permits us to remove the `KnownLayout` bounds from `Ptr::transmute`, and thus to remove `Ptr::transmute_sized` entirely. This also allows us to remove the hand-rolled impl of `TryFromBytes` for `ManuallyDrop<T>`, replacing it with an invocation of `impl_for_transmute_from!`. gherrit-pr-id: I090715fd9ed6f100fd35513b05054015621ecb9c
778227e to
ebfcd8b
Compare
TODO: - Figure out how to make this backwards-compatible (since current macros work with `T: Sized`, but `T: Sized` does not imply `T: KnownLayout`) - Make it so that `Sized` bounds are still enforced on older toolchains that don't support slice DST transmutes - Write safety comments - Get rid of now-unused macros and functions in util::macro_util Makes progress on #1817 gherrit-pr-id: Ib4bc62202e0b3b09d155333b525087f7aa8f02c2
ebfcd8b to
9e9502a
Compare
Member
Author
|
Closing in favor of #2428 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO:
T: Sized, butT: Sizeddoes not implyT: KnownLayout)Sizedbounds are still enforced on older toolchains that don't support slice DST transmutesMakes progress on #1817
gherrit-pr-id: Ib4bc62202e0b3b09d155333b525087f7aa8f02c2