about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lib.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-01-24 16:24:52 +0100
committerNadrieril <nadrieril+git@gmail.com>2024-01-31 19:22:48 +0100
commit400dc46a05f41ba1e1137f11073cec1951442668 (patch)
treee94e1c637e0ce2b312376d24ccb1e3cfe253d702 /compiler/rustc_pattern_analysis/src/lib.rs
parent11f32b73e0dc9287e305b5b9980d24aecdc8c17f (diff)
downloadrust-400dc46a05f41ba1e1137f11073cec1951442668.tar.gz
rust-400dc46a05f41ba1e1137f11073cec1951442668.zip
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.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs
index 3d0eb117d17..8e16d4d7bf4 100644
--- a/compiler/rustc_pattern_analysis/src/lib.rs
+++ b/compiler/rustc_pattern_analysis/src/lib.rs
@@ -123,7 +123,7 @@ pub trait TypeCx: Sized + fmt::Debug {
     ) -> fmt::Result;
 
     /// Raise a bug.
-    fn bug(&self, fmt: fmt::Arguments<'_>) -> !;
+    fn bug(&self, fmt: fmt::Arguments<'_>) -> Self::Error;
 
     /// Lint that the range `pat` overlapped with all the ranges in `overlaps_with`, where the range
     /// they overlapped over is `overlaps_on`. We only detect singleton overlaps.