diff options
| author | bors <bors@rust-lang.org> | 2023-09-06 02:37:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-06 02:37:41 +0000 |
| commit | aeddd2ddfd35bb385dd36476fab326f40d57a131 (patch) | |
| tree | d9b22494a97ded3f28faa3f223cafc578a18a311 /compiler/rustc_trait_selection/src | |
| parent | 25283f4e138866eed649fa6b18728c22662b2224 (diff) | |
| parent | 00010eda8b2828da967a562c093c6723889203ae (diff) | |
| download | rust-aeddd2ddfd35bb385dd36476fab326f40d57a131.tar.gz rust-aeddd2ddfd35bb385dd36476fab326f40d57a131.zip | |
Auto merge of #115529 - chenyukang:yukang-fix-115402-overflowsize, r=compiler-errors
Fix error report for size overflow from transmute Fixes #115402 The span in the error reporting always points to the `dst`, this is an old issue, I may open another PR to fix it.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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, |
