File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ impl<T: ?Sized> *const T {
709
709
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
710
710
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
711
711
#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
712
- pub const unsafe fn byte_offset_from ( self , origin : * const T ) -> isize {
712
+ pub const unsafe fn byte_offset_from < U : ? Sized > ( self , origin : * const U ) -> isize {
713
713
// SAFETY: the caller must uphold the safety contract for `offset_from`.
714
714
unsafe { self . cast :: < u8 > ( ) . offset_from ( origin. cast :: < u8 > ( ) ) }
715
715
}
Original file line number Diff line number Diff line change @@ -889,7 +889,7 @@ impl<T: ?Sized> *mut T {
889
889
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
890
890
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
891
891
#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
892
- pub const unsafe fn byte_offset_from ( self , origin : * const T ) -> isize {
892
+ pub const unsafe fn byte_offset_from < U : ? Sized > ( self , origin : * const U ) -> isize {
893
893
// SAFETY: the caller must uphold the safety contract for `offset_from`.
894
894
unsafe { self . cast :: < u8 > ( ) . offset_from ( origin. cast :: < u8 > ( ) ) }
895
895
}
Original file line number Diff line number Diff line change @@ -713,10 +713,11 @@ fn issue_39364() {
713
713
let t = thread:: spawn ( move || {
714
714
thread:: sleep ( Duration :: from_millis ( 300 ) ) ;
715
715
let _ = tx. clone ( ) ;
716
- crate :: mem:: forget ( tx) ;
716
+ // Don't drop; hand back to caller.
717
+ tx
717
718
} ) ;
718
719
719
720
let _ = rx. recv_timeout ( Duration :: from_millis ( 500 ) ) ;
720
- t. join ( ) . unwrap ( ) ;
721
+ let _tx = t. join ( ) . unwrap ( ) ; // delay dropping until end of test
721
722
let _ = rx. recv_timeout ( Duration :: from_millis ( 500 ) ) ;
722
723
}
You can’t perform that action at this time.
0 commit comments