make PointerKind directly reflect pointer types
The code that consumes PointerKind (`adjust_for_rust_scalar` in rustc_ty_utils) ended up using PointerKind variants to talk about Rust reference types (& and &mut) anyway, making the old code structure quite confusing: one always had to keep in mind which PointerKind corresponds to which type. So this changes PointerKind to directly reflect the type. This does not change behavior.
This commit is contained in:
@@ -1439,21 +1439,12 @@ impl<V: Idx> fmt::Debug for LayoutS<V> {
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum PointerKind {
|
||||
/// Most general case, we know no restrictions to tell LLVM.
|
||||
SharedMutable,
|
||||
|
||||
/// `&T` where `T` contains no `UnsafeCell`, is `dereferenceable`, `noalias` and `readonly`.
|
||||
Frozen,
|
||||
|
||||
/// `&mut T` which is `dereferenceable` and `noalias` but not `readonly`.
|
||||
UniqueBorrowed,
|
||||
|
||||
/// `&mut !Unpin`, which is `dereferenceable` but neither `noalias` nor `readonly`.
|
||||
UniqueBorrowedPinned,
|
||||
|
||||
/// `Box<T>`, which is `noalias` (even on return types, unlike the above) but neither `readonly`
|
||||
/// nor `dereferenceable`.
|
||||
UniqueOwned,
|
||||
/// Shared reference. `frozen` indicates the absence of any `UnsafeCell`.
|
||||
SharedRef { frozen: bool },
|
||||
/// Mutable reference. `unpin` indicates the absence of any pinned data.
|
||||
MutableRef { unpin: bool },
|
||||
/// Box.
|
||||
Box,
|
||||
}
|
||||
|
||||
/// Note that this information is advisory only, and backends are free to ignore it.
|
||||
|
||||
Reference in New Issue
Block a user