Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dc8cfe1

Browse files
authoredOct 25, 2023
Unrolled build for rust-lang#117159
Rollup merge of rust-lang#117159 - oli-obk:error_shenanigans, r=estebank Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed` Even if that error is only emitted by `check_mod_item_types`. fixes rust-lang#117153 A cleaner refactoring would merge/chain these queries in ways that ensure we only actually get an `ErrorGuaranteed` if there was an error emitted.
2 parents cf226e9 + beaf46f commit dc8cfe1

File tree

64 files changed

+661
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+661
-80
lines changed
 

‎compiler/rustc_hir_analysis/src/check/check.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
128128

129129
let param_env = tcx.param_env(item_def_id);
130130
for field in &def.non_enum_variant().fields {
131-
let field_ty = tcx.normalize_erasing_regions(param_env, field.ty(tcx, args));
131+
let Ok(field_ty) = tcx.try_normalize_erasing_regions(param_env, field.ty(tcx, args))
132+
else {
133+
tcx.sess.delay_span_bug(span, "could not normalize field type");
134+
continue;
135+
};
132136

133137
if !allowed_union_field(field_ty, tcx, param_env) {
134138
let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {

‎compiler/rustc_hir_analysis/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,19 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
202202
})?;
203203
}
204204

205-
tcx.sess.time("wf_checking", || {
205+
let errs = tcx.sess.time("wf_checking", || {
206206
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
207-
})?;
207+
});
208208

209209
// NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
210210
tcx.sess.time("item_types_checking", || {
211211
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
212212
});
213213

214+
// HACK: `check_mod_type_wf` may spuriously emit errors due to `delay_span_bug`, even if those errors
215+
// only actually get emitted in `check_mod_item_types`.
216+
errs?;
217+
214218
if tcx.features().rustc_attrs {
215219
tcx.sess.track_errors(|| collect::test_opaque_hidden_types(tcx))?;
216220
}

0 commit comments

Comments
 (0)
Please sign in to comment.