Convert bug
s back to delayed_bug
s.
This commit undoes some of the previous commit's mechanical changes, based on human judgment.
This commit is contained in:
parent
010f3944e0
commit
2903bbbc15
24 changed files with 87 additions and 42 deletions
|
@ -734,6 +734,10 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
|||
remapped_types.insert(def_id, ty::EarlyBinder::bind(ty));
|
||||
}
|
||||
Err(err) => {
|
||||
// This code path is not reached in any tests, but may be
|
||||
// reachable. If this is triggered, it should be converted to
|
||||
// `span_delayed_bug` and the triggering case turned into a
|
||||
// test.
|
||||
tcx.dcx()
|
||||
.span_bug(return_span, format!("could not fully resolve: {ty} => {err:?}"));
|
||||
}
|
||||
|
@ -914,7 +918,13 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
|
|||
.with_note(format!("hidden type inferred to be `{}`", self.ty))
|
||||
.emit()
|
||||
}
|
||||
_ => self.tcx.dcx().bug("should've been able to remap region"),
|
||||
_ => {
|
||||
// This code path is not reached in any tests, but may be
|
||||
// reachable. If this is triggered, it should be converted
|
||||
// to `delayed_bug` and the triggering case turned into a
|
||||
// test.
|
||||
self.tcx.dcx().bug("should've been able to remap region");
|
||||
}
|
||||
};
|
||||
return Err(guar);
|
||||
};
|
||||
|
@ -1273,6 +1283,8 @@ fn compare_number_of_generics<'tcx>(
|
|||
// inheriting the generics from will also have mismatched arguments, and
|
||||
// we'll report an error for that instead. Delay a bug for safety, though.
|
||||
if trait_.is_impl_trait_in_trait() {
|
||||
// FIXME: no tests trigger this. If you find example code that does
|
||||
// trigger this, please add it to the test suite.
|
||||
tcx.dcx()
|
||||
.bug("errors comparing numbers of generics of trait/impl functions were not emitted");
|
||||
}
|
||||
|
|
|
@ -154,6 +154,9 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
|
|||
trait_m_sig.inputs_and_output,
|
||||
));
|
||||
if !ocx.select_all_or_error().is_empty() {
|
||||
// This code path is not reached in any tests, but may be reachable. If
|
||||
// this is triggered, it should be converted to `delayed_bug` and the
|
||||
// triggering case turned into a test.
|
||||
tcx.dcx().bug("encountered errors when checking RPITIT refinement (selection)");
|
||||
}
|
||||
let outlives_env = OutlivesEnvironment::with_bounds(
|
||||
|
@ -162,10 +165,16 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
|
|||
);
|
||||
let errors = infcx.resolve_regions(&outlives_env);
|
||||
if !errors.is_empty() {
|
||||
// This code path is not reached in any tests, but may be reachable. If
|
||||
// this is triggered, it should be converted to `delayed_bug` and the
|
||||
// triggering case turned into a test.
|
||||
tcx.dcx().bug("encountered errors when checking RPITIT refinement (regions)");
|
||||
}
|
||||
// Resolve any lifetime variables that may have been introduced during normalization.
|
||||
let Ok((trait_bounds, impl_bounds)) = infcx.fully_resolve((trait_bounds, impl_bounds)) else {
|
||||
// This code path is not reached in any tests, but may be reachable. If
|
||||
// this is triggered, it should be converted to `delayed_bug` and the
|
||||
// triggering case turned into a test.
|
||||
tcx.dcx().bug("encountered errors when checking RPITIT refinement (resolution)");
|
||||
};
|
||||
|
||||
|
|
|
@ -67,10 +67,11 @@ pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), Erro
|
|||
// already checked by coherence, but compilation may
|
||||
// not have been terminated.
|
||||
let span = tcx.def_span(drop_impl_did);
|
||||
tcx.dcx().span_bug(
|
||||
let reported = tcx.dcx().span_delayed_bug(
|
||||
span,
|
||||
format!("should have been rejected by coherence check: {dtor_self_type}"),
|
||||
);
|
||||
Err(reported)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1087,12 +1087,8 @@ fn check_type_defn<'tcx>(
|
|||
packed && {
|
||||
let ty = tcx.type_of(variant.tail().did).instantiate_identity();
|
||||
let ty = tcx.erase_regions(ty);
|
||||
if ty.has_infer() {
|
||||
// Unresolved type expression.
|
||||
tcx.dcx().span_bug(item.span, format!("inference variables in {ty:?}"));
|
||||
} else {
|
||||
ty.needs_drop(tcx, tcx.param_env(item.owner_id))
|
||||
}
|
||||
assert!(!ty.has_infer());
|
||||
ty.needs_drop(tcx, tcx.param_env(item.owner_id))
|
||||
}
|
||||
};
|
||||
// All fields (except for possibly the last) should be sized.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue