From 00010eda8b2828da967a562c093c6723889203ae Mon Sep 17 00:00:00 2001 From: yukang Date: Sun, 3 Sep 2023 10:58:13 +0800 Subject: Fix error report for size overflow from transmute --- .../rustc_trait_selection/src/traits/error_reporting/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/rustc_trait_selection/src/traits') diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 457d5420ca3..746a38f956a 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2920,6 +2920,16 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { rustc_transmute::Reason::DstIsTooBig => { format!("The size of `{src}` is smaller than the size of `{dst}`") } + rustc_transmute::Reason::SrcSizeOverflow => { + format!( + "values of the type `{src}` are too big for the current architecture" + ) + } + rustc_transmute::Reason::DstSizeOverflow => { + format!( + "values of the type `{dst}` are too big for the current architecture" + ) + } rustc_transmute::Reason::DstHasStricterAlignment { src_min_align, dst_min_align, -- cgit 1.4.1-3-g733a5