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.
This commit is contained in:
commit
aeddd2ddfd
6 changed files with 79 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue