Gracefully abort on type incompatibility

Since the only use of `TypeCx::bug` is in `Constructor::is_covered_by`,
it is tempting to return `false` instead of `Err()`, but that would
cause "non-exhaustive match" false positives.
This commit is contained in:
Nadrieril
2024-01-24 16:24:52 +01:00
parent 11f32b73e0
commit 400dc46a05
5 changed files with 18 additions and 14 deletions

View File

@@ -900,7 +900,7 @@ impl<'p, 'tcx> TypeCx for RustcMatchCheckCtxt<'p, 'tcx> {
Ok(())
}
fn bug(&self, fmt: fmt::Arguments<'_>) -> ! {
fn bug(&self, fmt: fmt::Arguments<'_>) -> Self::Error {
span_bug!(self.scrut_span, "{}", fmt)
}