Skip to content

Commit 4e65105

Browse files
committed
to span_delayed_bug
1 parent fc48840 commit 4e65105

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,15 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
224224
&opaque_types,
225225
);
226226

227-
if let Some((key, hidden_type)) = infcx
227+
for (key, hidden_type) in infcx
228228
.inner
229229
.borrow_mut()
230230
.opaque_types()
231231
.opaque_types_added_since(opaque_types_storage_num_entries)
232-
.next()
233232
{
234233
let opaque_type_string = tcx.def_path_str(key.def_id);
235234
let msg = format!("unexpected cyclic definition of `{opaque_type_string}`");
236-
infcx.dcx().span_bug(hidden_type.span, msg);
235+
infcx.dcx().span_delayed_bug(hidden_type.span, msg);
237236
}
238237

239238
let _ = infcx.take_opaque_types();

compiler/rustc_hir_typeck/src/opaque_types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
132132
/// then, either allowing compilation to succeed or causing an ambiguity error.
133133
pub(super) fn detect_opaque_types_added_during_writeback(&self) {
134134
let num_entries = self.checked_opaque_types_storage_entries.take().unwrap();
135-
if let Some((key, hidden_type)) =
136-
self.inner.borrow_mut().opaque_types().opaque_types_added_since(num_entries).next()
135+
for (key, hidden_type) in
136+
self.inner.borrow_mut().opaque_types().opaque_types_added_since(num_entries)
137137
{
138138
let opaque_type_string = self.tcx.def_path_str(key.def_id);
139139
let msg = format!("unexpected cyclic definition of `{opaque_type_string}`");
140-
self.dcx().span_bug(hidden_type.span, msg);
140+
self.dcx().span_delayed_bug(hidden_type.span, msg);
141141
}
142142
let _ = self.take_opaque_types();
143143
}

0 commit comments

Comments
 (0)