1
Fork 0

Convert delayed_bugs to bugs.

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.

The next commit will convert some more back, based on human judgment.
This commit is contained in:
Nicholas Nethercote 2024-02-17 01:23:40 +11:00
parent bb594538fc
commit 010f3944e0
44 changed files with 87 additions and 157 deletions

View file

@ -90,8 +90,7 @@ fn univariant_uninterned<'tcx>(
let dl = cx.data_layout();
let pack = repr.pack;
if pack.is_some() && repr.align.is_some() {
cx.tcx.dcx().delayed_bug("struct cannot be packed and aligned");
return Err(cx.tcx.arena.alloc(LayoutError::Unknown(ty)));
cx.tcx.dcx().bug("struct cannot be packed and aligned");
}
cx.univariant(dl, fields, repr, kind).ok_or_else(|| error(cx, LayoutError::SizeOverflow(ty)))

View file

@ -337,7 +337,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInAssocTypeCollector<'tcx> {
.instantiate(self.0.tcx, impl_args)
.visit_with(self);
} else {
self.0.tcx.dcx().span_delayed_bug(
self.0.tcx.dcx().span_bug(
self.0.tcx.def_span(assoc.def_id),
"item had incorrect args",
);