about summary refs log tree commit diff
path: root/compiler/rustc_transmute/src/layout/tree.rs
diff options
context:
space:
mode:
authorBryan Garza <1396101+bryangarza@users.noreply.github.com>2023-06-12 16:35:23 -0700
committerBryan Garza <1396101+bryangarza@users.noreply.github.com>2023-06-12 16:56:21 -0700
commitf4cf8f65a5e8e110c8c36469d31f16e8571e2c1a (patch)
tree81d55477f266bac64272420ca537903b35a17fb8 /compiler/rustc_transmute/src/layout/tree.rs
parent64a54df86faf1f55148433753296dc2bc2a7e31d (diff)
downloadrust-f4cf8f65a5e8e110c8c36469d31f16e8571e2c1a.tar.gz
rust-f4cf8f65a5e8e110c8c36469d31f16e8571e2c1a.zip
Safe Transmute: Refactor error handling and Answer type
- Create `Answer` type that is not just a type alias of `Result`
- Remove a usage of `map_layouts` to make the code easier to read
- Don't hide errors related to Unknown Layout when computing transmutability
Diffstat (limited to 'compiler/rustc_transmute/src/layout/tree.rs')
-rw-r--r--compiler/rustc_transmute/src/layout/tree.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index ed9309b015d..6b718be7b15 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -188,14 +188,14 @@ pub(crate) mod rustc {
         /// The layout of the type is unspecified.
         Unspecified,
         /// This error will be surfaced elsewhere by rustc, so don't surface it.
-        Unknown,
+        UnknownLayout,
         TypeError(ErrorGuaranteed),
     }
 
     impl<'tcx> From<LayoutError<'tcx>> for Err {
         fn from(err: LayoutError<'tcx>) -> Self {
             match err {
-                LayoutError::Unknown(..) => Self::Unknown,
+                LayoutError::Unknown(..) => Self::UnknownLayout,
                 err => unimplemented!("{:?}", err),
             }
         }