about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-25 19:29:58 +0000
committerbors <bors@rust-lang.org>2023-10-25 19:29:58 +0000
commitab5c841a1f3c09edc5ea07722519627c960aed17 (patch)
tree0d4c4f6e16659ad8bba579c4b446c9b9a3b3566d /compiler/rustc_hir_analysis/src
parentcf226e93dcb0e21e2daa7c26aca0c5b46ff1b646 (diff)
parentb0521fe88e05dfc2776ebb5b98931b2373910629 (diff)
downloadrust-ab5c841a1f3c09edc5ea07722519627c960aed17.tar.gz
rust-ab5c841a1f3c09edc5ea07722519627c960aed17.zip
Auto merge of #117180 - matthiaskrgr:rollup-rxhl6ep, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #117111 (Remove support for alias `-Z instrument-coverage`)
 - #117141 (Require target features to match exactly during inlining)
 - #117152 (Fix unwrap suggestion for async fn)
 - #117154 (implement C ABI lowering for CSKY)
 - #117159 (Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`)
 - #117163 (compiletest: Display compilation errors in mir-opt tests)
 - #117173 (Make `Iterator` a lang item)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/lib.rs8
2 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 360d31b863c..e61ca232de6 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -128,7 +128,11 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
 
         let param_env = tcx.param_env(item_def_id);
         for field in &def.non_enum_variant().fields {
-            let field_ty = tcx.normalize_erasing_regions(param_env, field.ty(tcx, args));
+            let Ok(field_ty) = tcx.try_normalize_erasing_regions(param_env, field.ty(tcx, args))
+            else {
+                tcx.sess.delay_span_bug(span, "could not normalize field type");
+                continue;
+            };
 
             if !allowed_union_field(field_ty, tcx, param_env) {
                 let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index f27ce7fa0e0..2b8219c01c7 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -202,15 +202,19 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
         })?;
     }
 
-    tcx.sess.time("wf_checking", || {
+    let errs = tcx.sess.time("wf_checking", || {
         tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
-    })?;
+    });
 
     // NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
     tcx.sess.time("item_types_checking", || {
         tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
     });
 
+    // HACK: `check_mod_type_wf` may spuriously emit errors due to `delay_span_bug`, even if those errors
+    // only actually get emitted in `check_mod_item_types`.
+    errs?;
+
     if tcx.features().rustc_attrs {
         tcx.sess.track_errors(|| collect::test_opaque_hidden_types(tcx))?;
     }