Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
adwinwhite
reviewed
Oct 30, 2026
Comment on lines
+15
to
+26
| const _: () = assert!(size_of::<unsafe<'a> &'a u8>() == size_of::<&u8>()); | ||
| const _: () = assert!(size_of::<Option<unsafe<'a> &'a u8>>() == size_of::<&u8>()); | ||
| const _: () = assert!(size_of::<Option<unsafe<> NonZero<u32>>>() == 4); | ||
| const _: () = assert!(align_of::<unsafe<'a> (&'a u8, u16)>() == align_of::<(&u8, u16)>()); | ||
|
|
||
| // The vtable niche survives a binder in the metadata type and in the pointee. | ||
| type BoundMeta = DynMetadata<unsafe<'a> MD<dyn Debug + 'a>>; | ||
| const _: () = assert!(size_of::<Option<BoundMeta>>() == size_of::<BoundMeta>()); | ||
| const _: () = assert!( | ||
| size_of::<Option<*const unsafe<'a> MD<dyn Debug + 'a>>>() | ||
| == size_of::<*const unsafe<'a> MD<dyn Debug + 'a>>() | ||
| ); |
Contributor
There was a problem hiding this comment.
We can assert the layouts of unsafe binders versions are the same as inner types? This currently tests both layout equality and niche optimization.
Comment on lines
+18
to
+19
| assert_eq!(type_name::<unsafe<'a> &'a ()>(), "unsafe<> &'_ ()"); | ||
| assert_eq!(type_name::<unsafe<'a> (&'a u8, u8)>(), "unsafe<> (&'_ u8, u8)"); |
Contributor
There was a problem hiding this comment.
Should include bound vars as well?
Comment on lines
+15
to
+18
| fn launder_free<'x>(r: &'x String) -> &'static String { | ||
| let b: unsafe<'a> (&'a u8, &'x String) = unsafe { wrap_binder!((&0, r)) }; | ||
| unsafe { unwrap_binder!(b).1 } | ||
| } |
Contributor
There was a problem hiding this comment.
this is testing the same early param lifetime as the test case above rather than an temporary body region?
This comment has been minimized.
This comment has been minimized.
rust-cloud-vms
Bot
force-pushed
the
unsafe-binders-impl
branch
from
November 19, 2026 15:33
3deb9c1 to
6f7011c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rust-cloud-vms
Bot
force-pushed
the
unsafe-binders-impl
branch
from
November 21, 2026 00:00
6f7011c to
0f4a9a8
Compare
rust-cloud-vms
Bot
force-pushed
the
unsafe-binders-impl
branch
from
November 21, 2026 02:56
0f4a9a8 to
55bfb16
Compare
This branch has not been deployed
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.
View all comments
Supersedes #153458, #156373, #154524, #158856
First test adds many tests covering (expected) implementation behavior of unsafe binders. Many of these need further design discussion, but the point here is to figure out some behavior that we can pin an implementation to for testing.
Remaining commits fix broken tests one by one (mostly), and should be fairly independent.