Repository navigation
Conversation
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
|
||
| fn capture_move(x: MD<String>) -> unsafe<> MD<String> { | ||
| let f = || -> unsafe<> MD<String> { unsafe { wrap_binder!(x) } }; | ||
| f() |
There was a problem hiding this comment.
We should use x again to verify that it moved?
| //~^ ERROR conflicting implementations of trait `Tr` for type `unsafe<'a> &'a Local` | ||
| impl Tr for &'static Local {} | ||
| impl<'x> Tr for unsafe<> &'x Local {} | ||
| //~^ WARN conflicting implementations of trait `Tr` for type `unsafe<'a> &'a Local` |
There was a problem hiding this comment.
This should be ERROR rather than WARN, right?
|
|
||
| // A generic unwrap_binder in a array length position should work (if otherwise allowed). | ||
|
|
||
| #![feature(unsafe_binders, generic_const_exprs)] |
There was a problem hiding this comment.
GCE is to be yeeted and we should support GCA instead?
| 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>>() | ||
| ); |
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.
| } | ||
| // error | ||
| fn wrap_mismatch_bound_vars() { | ||
| let _x: unsafe<'a> &'a u8 = unsafe { wrap_binder!(&0; unsafe<'a, 'b> &'a &'b u8) }; |
There was a problem hiding this comment.
We don't have auto-deref into the unsafe binders so the inner types on both sides modulo regions are different, &u8 vs &&u8. This isn't what we want to test, right?
| assert_eq!(type_name::<unsafe<'a> &'a ()>(), "unsafe<> &'_ ()"); | ||
| assert_eq!(type_name::<unsafe<'a> (&'a u8, u8)>(), "unsafe<> (&'_ u8, u8)"); |
There was a problem hiding this comment.
Should include bound vars as well?
| 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 } | ||
| } |
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?
| } | ||
|
|
||
| fn h(mut b: unsafe<> u8) -> unsafe<> u8 { | ||
| unsafe { unwrap_binder!(b) = 1 }; |
There was a problem hiding this comment.
should comment that we support this?
| //@ edition: 2024 | ||
| //@ check-pass | ||
|
|
||
| // Unsafe binders can be held across `.await`, and the future stays `Send`. |
There was a problem hiding this comment.
this is redundant as we test Send in send-sync.rs?
| //@ check-pass | ||
| //@ known-bug: #130516 | ||
|
|
||
| // Casts fwith unsafe binders should not change the metadata kind or the |
|
☔ The latest upstream changes (presumably #165234) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
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.