@@ -379,25 +379,29 @@ fn adjust_for_rust_scalar<'tcx>(
379
379
Some ( kind)
380
380
} else if let Some ( pointee) = drop_target_pointee {
381
381
// The argument to `drop_in_place` is semantically equivalent to a mutable reference.
382
- Some ( PointerKind :: MutableRef { unpin : pointee. is_unpin ( tcx, cx. typing_env ) } )
382
+ Some ( PointerKind :: MutableRef {
383
+ unsafe_unpin : pointee. is_unsafe_unpin ( tcx, cx. typing_env ) ,
384
+ } )
383
385
} else {
384
386
None
385
387
} ;
386
388
if let Some ( kind) = kind {
387
389
attrs. pointee_align = Some ( pointee. align ) ;
388
390
389
391
// `Box` are not necessarily dereferenceable for the entire duration of the function as
390
- // they can be deallocated at any time. Same for non-frozen shared references (see
391
- // <https://github.com/rust-lang/rust/pull/98017>), and for mutable references to
392
- // potentially self-referential types (see
393
- // <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>). If LLVM had a way
394
- // to say "dereferenceable on entry" we could use it here.
392
+ // they can be deallocated at any time. Same for `!Freeze` shared references
393
+ // (see <https://github.com/rust-lang/rust/pull/98017>), and for mutable
394
+ // references to `!UnsafeUnpin` (ie. potentially self-referential types)
395
+ // (see <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>
396
+ // and <https://rust-lang.github.io/rfcs/3467-unsafe-pinned.html>).
397
+ //
398
+ // If LLVM had a way to say "dereferenceable on entry" we could use it here.
395
399
attrs. pointee_size = match kind {
396
400
PointerKind :: Box { .. }
397
401
| PointerKind :: SharedRef { frozen : false }
398
- | PointerKind :: MutableRef { unpin : false } => Size :: ZERO ,
402
+ | PointerKind :: MutableRef { unsafe_unpin : false } => Size :: ZERO ,
399
403
PointerKind :: SharedRef { frozen : true }
400
- | PointerKind :: MutableRef { unpin : true } => pointee. size ,
404
+ | PointerKind :: MutableRef { unsafe_unpin : true } => pointee. size ,
401
405
} ;
402
406
403
407
// The aliasing rules for `Box<T>` are still not decided, but currently we emit
@@ -418,8 +422,10 @@ fn adjust_for_rust_scalar<'tcx>(
418
422
// `&mut T` and `Box<T>` where `T: Unpin` are unique and hence `noalias`.
419
423
let no_alias = match kind {
420
424
PointerKind :: SharedRef { frozen } => frozen,
421
- PointerKind :: MutableRef { unpin } => unpin && noalias_mut_ref,
422
- PointerKind :: Box { unpin, global } => unpin && global && noalias_for_box,
425
+ PointerKind :: MutableRef { unsafe_unpin } => unsafe_unpin && noalias_mut_ref,
426
+ PointerKind :: Box { unsafe_unpin, global } => {
427
+ unsafe_unpin && global && noalias_for_box
428
+ }
423
429
} ;
424
430
// We can never add `noalias` in return position; that LLVM attribute has some very surprising semantics
425
431
// (see <https://github.com/rust-lang/unsafe-code-guidelines/issues/385#issuecomment-1368055745>).
0 commit comments