diff options
| author | Bryan Garza <1396101+bryangarza@users.noreply.github.com> | 2023-04-27 14:38:32 -0700 |
|---|---|---|
| committer | Bryan Garza <1396101+bryangarza@users.noreply.github.com> | 2023-05-24 14:52:19 -0700 |
| commit | 263a4f2cb6b455f9c4ae46493d59369c378a85ea (patch) | |
| tree | 5b928687e50f2cfa00f7555552590a3610539b8e /compiler/rustc_transmute/src/maybe_transmutable/tests.rs | |
| parent | 8f1cec8d8472c3ffacedd4783c64182a407c72df (diff) | |
| download | rust-263a4f2cb6b455f9c4ae46493d59369c378a85ea.tar.gz rust-263a4f2cb6b455f9c4ae46493d59369c378a85ea.zip | |
Safe Transmute: Change Answer type to Result
This patch updates the `Answer` type from `rustc_transmute` so that it just a type alias to `Result`. This makes it so that the standard methods for `Result` can be used to process the `Answer` tree, including being able to make use of the `?` operator on `Answer`s. Also, remove some unused functions
Diffstat (limited to 'compiler/rustc_transmute/src/maybe_transmutable/tests.rs')
| -rw-r--r-- | compiler/rustc_transmute/src/maybe_transmutable/tests.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_transmute/src/maybe_transmutable/tests.rs b/compiler/rustc_transmute/src/maybe_transmutable/tests.rs index a8675f4ae37..df6a83df23f 100644 --- a/compiler/rustc_transmute/src/maybe_transmutable/tests.rs +++ b/compiler/rustc_transmute/src/maybe_transmutable/tests.rs @@ -1,6 +1,6 @@ use super::query_context::test::{Def, UltraMinimal}; use crate::maybe_transmutable::MaybeTransmutableQuery; -use crate::{layout, Answer, Reason}; +use crate::{layout, Reason}; use itertools::Itertools; mod bool { @@ -17,7 +17,7 @@ mod bool { UltraMinimal, ) .answer(); - assert_eq!(answer, Answer::Yes); + assert_eq!(answer, Ok(None)); } #[test] @@ -30,7 +30,7 @@ mod bool { UltraMinimal, ) .answer(); - assert_eq!(answer, Answer::Yes); + assert_eq!(answer, Ok(None)); } #[test] @@ -65,7 +65,7 @@ mod bool { if src_set.is_subset(&dst_set) { assert_eq!( - Answer::Yes, + Ok(None), MaybeTransmutableQuery::new( src_layout.clone(), dst_layout.clone(), @@ -80,7 +80,7 @@ mod bool { ); } else if !src_set.is_disjoint(&dst_set) { assert_eq!( - Answer::Yes, + Ok(None), MaybeTransmutableQuery::new( src_layout.clone(), dst_layout.clone(), @@ -95,7 +95,7 @@ mod bool { ); } else { assert_eq!( - Answer::No(Reason::DstIsBitIncompatible), + Err(Reason::DstIsBitIncompatible), MaybeTransmutableQuery::new( src_layout.clone(), dst_layout.clone(), |
