File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -3381,7 +3381,11 @@ impl<T> Default for Arc<[T]> {
33813381 #[ inline]
33823382 fn default ( ) -> Self {
33833383 if mem:: align_of :: < T > ( ) <= MAX_STATIC_INNER_SLICE_ALIGNMENT {
3384- let inner: NonNull < ArcInner < [ u8 ; 1 ] > > = NonNull :: from ( & STATIC_INNER_SLICE . inner ) ;
3384+ // We take a reference to the whole struct instead of the ArcInner<[u8; 1]> inside it so
3385+ // we don't shrink the range of bytes the ptr is allowed to access under Stacked Borrows.
3386+ // (Miri complains on 32-bit targets with Arc<[Align16]> otherwise.)
3387+ // (Note that NonNull::from(&STATIC_INNER_SLICE.inner) is fine under Tree Borrows.)
3388+ let inner: NonNull < SliceArcInnerForStatic > = NonNull :: from ( & STATIC_INNER_SLICE ) ;
33853389 let inner: NonNull < ArcInner < [ T ; 0 ] > > = inner. cast ( ) ;
33863390 // `this` semantically is the Arc "owned" by the static, so make sure not to drop it.
33873391 let this: mem:: ManuallyDrop < Arc < [ T ; 0 ] > > = unsafe { mem:: ManuallyDrop :: new ( Arc :: from_inner ( inner) ) } ;
You can’t perform that action at this time.
0 commit comments