Fix error report for size overflow from transmute

This commit is contained in:
yukang
2023-09-03 10:58:13 +08:00
parent b588641208
commit 00010eda8b
6 changed files with 79 additions and 0 deletions

View File

@@ -189,6 +189,8 @@ pub(crate) mod rustc {
Unspecified,
/// This error will be surfaced elsewhere by rustc, so don't surface it.
UnknownLayout,
/// Overflow size
SizeOverflow,
TypeError(ErrorGuaranteed),
}
@@ -196,6 +198,7 @@ pub(crate) mod rustc {
fn from(err: &LayoutError<'tcx>) -> Self {
match err {
LayoutError::Unknown(..) | LayoutError::ReferencesError(..) => Self::UnknownLayout,
LayoutError::SizeOverflow(..) => Self::SizeOverflow,
err => unimplemented!("{:?}", err),
}
}