diff options
| author | bors <bors@rust-lang.org> | 2024-02-05 21:36:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-05 21:36:25 +0000 |
| commit | f067fd6084d750f3797f54b71771c5dbc149726f (patch) | |
| tree | 4dd1eede2b078f8ee37e192ac5a107feb3770f33 /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | ea37e8091fe87ae0a7e204c034e7d55061e56790 (diff) | |
| parent | 400dc46a05f41ba1e1137f11073cec1951442668 (diff) | |
| download | rust-f067fd6084d750f3797f54b71771c5dbc149726f.tar.gz rust-f067fd6084d750f3797f54b71771c5dbc149726f.zip | |
Auto merge of #120313 - Nadrieril:graceful-error, r=compiler-errors
pattern_analysis: Gracefully abort on type incompatibility This leaves the option for a consumer of the crate to return `Err` instead of panicking on type error. rust-analyzer could use that (e.g. https://github.com/rust-lang/rust-analyzer/issues/15808). 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. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 2 |
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. |
