1
Fork 0

Rollup merge of #121208 - nnethercote:delayed_bug-to-bug, r=lcnr

Convert `delayed_bug`s to `bug`s.

I have a suspicion that quite a few delayed bug paths are impossible to reach, so I did an experiment.

I converted every `delayed_bug` to a `bug`, ran the full test suite, then converted back every `bug` that was hit. A surprising number were never hit.

This is too dangerous to merge. Increased coverage (fuzzing or a crater run) would likely hit more cases. But it might be useful for people to look at and think about which paths are genuinely unreachable.

r? `@ghost`
This commit is contained in:
Dylan DPC 2024-02-21 08:55:56 +00:00 committed by GitHub
commit d5206c6ecd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 130 additions and 155 deletions

View file

@ -410,8 +410,7 @@ impl<'tcx> TypeckResults<'tcx> {
pub fn extract_binding_mode(&self, s: &Session, id: HirId, sp: Span) -> Option<BindingMode> {
self.pat_binding_modes().get(id).copied().or_else(|| {
s.dcx().span_delayed_bug(sp, "missing binding mode");
None
s.dcx().span_bug(sp, "missing binding mode");
})
}