rename PointerKind::Shared → SharedMutable to indicate this is NOT the usual shared reference

This commit is contained in:
Ralf Jung 2022-06-11 23:20:00 -07:00
parent 22d25f21dc
commit 307e80c1a6
2 changed files with 5 additions and 5 deletions

View File

@ -2618,14 +2618,14 @@ where
// Use conservative pointer kind if not optimizing. This saves us the
// Freeze/Unpin queries, and can save time in the codegen backend (noalias
// attributes in LLVM have compile-time cost even in unoptimized builds).
PointerKind::Shared
PointerKind::SharedMutable
} else {
match mt {
hir::Mutability::Not => {
if ty.is_freeze(tcx.at(DUMMY_SP), cx.param_env()) {
PointerKind::Frozen
} else {
PointerKind::Shared
PointerKind::SharedMutable
}
}
hir::Mutability::Mut => {
@ -2636,7 +2636,7 @@ where
if ty.is_unpin(tcx.at(DUMMY_SP), cx.param_env()) {
PointerKind::UniqueBorrowed
} else {
PointerKind::Shared
PointerKind::SharedMutable
}
}
}
@ -3285,7 +3285,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
// or not to actually emit the attribute. It can also be controlled with the
// `-Zmutable-noalias` debugging option.
let no_alias = match kind {
PointerKind::Shared | PointerKind::UniqueBorrowed => false,
PointerKind::SharedMutable | PointerKind::UniqueBorrowed => false,
PointerKind::UniqueOwned => noalias_for_box,
PointerKind::Frozen => !is_return,
};

View File

@ -1350,7 +1350,7 @@ impl<'a, Ty> Deref for TyAndLayout<'a, Ty> {
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum PointerKind {
/// Most general case, we know no restrictions to tell LLVM.
Shared,
SharedMutable,
/// `&T` where `T` contains no `UnsafeCell`, is `noalias` and `readonly`.
Frozen,