@@ -2636,7 +2636,7 @@ where
26362636 if ty. is_unpin ( tcx. at ( DUMMY_SP ) , cx. param_env ( ) ) {
26372637 PointerKind :: UniqueBorrowed
26382638 } else {
2639- PointerKind :: SharedMutable
2639+ PointerKind :: UniqueBorrowedPinned
26402640 }
26412641 }
26422642 }
@@ -3255,10 +3255,13 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
32553255
32563256 // `Box` (`UniqueBorrowed`) are not necessarily dereferenceable
32573257 // for the entire duration of the function as they can be deallocated
3258- // at any time. Set their valid size to 0.
3258+ // at any time. Same for shared mutable references. If LLVM had a
3259+ // way to say "dereferenceable on entry" we could use it here.
32593260 attrs. pointee_size = match kind {
3260- PointerKind :: UniqueOwned => Size :: ZERO ,
3261- _ => pointee. size ,
3261+ PointerKind :: UniqueBorrowed
3262+ | PointerKind :: UniqueBorrowedPinned
3263+ | PointerKind :: Frozen => pointee. size ,
3264+ PointerKind :: SharedMutable | PointerKind :: UniqueOwned => Size :: ZERO ,
32623265 } ;
32633266
32643267 // `Box`, `&T`, and `&mut T` cannot be undef.
@@ -3285,7 +3288,9 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
32853288 // or not to actually emit the attribute. It can also be controlled with the
32863289 // `-Zmutable-noalias` debugging option.
32873290 let no_alias = match kind {
3288- PointerKind :: SharedMutable | PointerKind :: UniqueBorrowed => false ,
3291+ PointerKind :: SharedMutable
3292+ | PointerKind :: UniqueBorrowed
3293+ | PointerKind :: UniqueBorrowedPinned => false ,
32893294 PointerKind :: UniqueOwned => noalias_for_box,
32903295 PointerKind :: Frozen => !is_return,
32913296 } ;
0 commit comments