diff options
author | Ralf Jung <post@ralfj.de> | 2022-12-27 12:31:17 +0100 |
---|---|---|
committer | Ralf Jung <post@ralfj.de> | 2023-02-06 11:46:32 +0100 |
commit | 201ae7387245caa4591d4c8db4c35c170c64faf0 (patch) | |
tree | 011ec2bc77cfee914cfab9d89b61c40232046986 /compiler/rustc_abi | |
parent | 0c13c172507f01d921808107d2c4ec37b43b982d (diff) | |
download | rust-201ae7387245caa4591d4c8db4c35c170c64faf0.tar.gz |
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.
Diffstat (limited to 'compiler/rustc_abi')
-rw-r--r-- | compiler/rustc_abi/src/lib.rs | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 5af6206c0bb..9126c516d38 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -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. |