about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-08 23:33:28 +0200
committerGitHub <noreply@github.com>2024-05-08 23:33:28 +0200
commit782ef181683cb5568e23f1071cfff9c5daa8564c (patch)
tree560eb5f6e45aea26ffbd911e6792563df19bd57f /compiler
parent18639db87c2200cfcf51dc5f30e3b7d1cfe8e9f3 (diff)
parentcacc0829ffa012e1e6a84ad35160533431a2d269 (diff)
downloadrust-782ef181683cb5568e23f1071cfff9c5daa8564c.tar.gz
rust-782ef181683cb5568e23f1071cfff9c5daa8564c.zip
Rollup merge of #124909 - compiler-errors:struct-tail-leftovers, r=compiler-errors
Reapply the part of #124548 that bors forgot

https://github.com/rust-lang/rust/pull/124548#issuecomment-2101311205
r? compiler-errors
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index f17413af777..8873025e440 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -338,13 +338,14 @@ impl<'tcx> SizeSkeleton<'tcx> {
                     pointee,
                     |ty| match tcx.try_normalize_erasing_regions(param_env, ty) {
                         Ok(ty) => ty,
-                        Err(_e) => {
-                            if let Some(guar) = tcx.dcx().has_errors() {
-                                Ty::new_error(tcx, guar)
-                            } else {
-                                bug!("normalization failed, but no errors reported");
-                            }
-                        }
+                        Err(e) => Ty::new_error_with_message(
+                            tcx,
+                            DUMMY_SP,
+                            format!(
+                                "normalization failed for {} but no errors reported",
+                                e.get_type_for_failure()
+                            ),
+                        ),
                     },
                     || {},
                 );