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
This commit is contained in:
parent
64a54df86f
commit
f4cf8f65a5
9 changed files with 166 additions and 126 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue