File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -2314,10 +2314,12 @@ impl<T: ?Sized> Unpin for Rc<T> {}
2314
2314
/// The pointer must point to (and have valid metadata for) a previously
2315
2315
/// valid instance of T, but the T is allowed to be dropped.
2316
2316
unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
2317
- // Align the unsized value to the end of the `RcBox`.
2318
- // Because it is ?Sized, it will always be the last field in memory.
2319
- // Note: This is a detail of the current implementation of the compiler,
2320
- // and is not a guaranteed language detail. Do not rely on it outside of std.
2317
+ // Align the unsized value to the end of the RcBox.
2318
+ // Because RcBox is repr(C), it will always be the last field in memory.
2319
+ // SAFETY: since the only unsized types possible are slices, trait objects,
2320
+ // and extern types, the input safety requirement is currently enough to
2321
+ // satisfy the requirements of align_of_val_raw; this is an implementation
2322
+ // detail of the language that may not be relied upon outside of std.
2321
2323
unsafe { data_offset_align ( align_of_val_raw ( ptr) ) }
2322
2324
}
2323
2325
Original file line number Diff line number Diff line change @@ -2464,10 +2464,12 @@ impl<T: ?Sized> Unpin for Arc<T> {}
2464
2464
/// The pointer must point to (and have valid metadata for) a previously
2465
2465
/// valid instance of T, but the T is allowed to be dropped.
2466
2466
unsafe fn data_offset < T : ?Sized > ( ptr : * const T ) -> isize {
2467
- // Align the unsized value to the end of the `ArcInner`.
2468
- // Because it is `?Sized`, it will always be the last field in memory.
2469
- // Note: This is a detail of the current implementation of the compiler,
2470
- // and is not a guaranteed language detail. Do not rely on it outside of std.
2467
+ // Align the unsized value to the end of the ArcInner.
2468
+ // Because RcBox is repr(C), it will always be the last field in memory.
2469
+ // SAFETY: since the only unsized types possible are slices, trait objects,
2470
+ // and extern types, the input safety requirement is currently enough to
2471
+ // satisfy the requirements of align_of_val_raw; this is an implementation
2472
+ // detail of the language that may not be relied upon outside of std.
2471
2473
unsafe { data_offset_align ( align_of_val_raw ( ptr) ) }
2472
2474
}
2473
2475
You can’t perform that action at this time.
0 commit comments