about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lints.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-27 07:48:29 +0000
committerbors <bors@rust-lang.org>2023-12-27 07:48:29 +0000
commit9da44323c9de0b8adef7d8d0a9f61bddd36d15a2 (patch)
treea75a193546a5c6fb4f04645750939828fe0abaf8 /compiler/rustc_pattern_analysis/src/lints.rs
parent625c2c401fae15dc3484cb25313ddff39b7e016c (diff)
parentfc0be3c921abc95e50e9fcb50598f2b6ee6fb4d4 (diff)
downloadrust-9da44323c9de0b8adef7d8d0a9f61bddd36d15a2.tar.gz
rust-9da44323c9de0b8adef7d8d0a9f61bddd36d15a2.zip
Auto merge of #119233 - Nadrieril:keep-whole-pat-around, r=compiler-errors
Exhaustiveness: keep the original `thir::Pat` around

This PR makes it possible for exhaustiveness to look at the original `thir::Pat`, which I'll need at least for the [`small_gaps`](https://github.com/rust-lang/rust/pull/118879) lint (without that we can't distinguish inclusive and exclusive ranges within exhaustiveness). This PR is almost entirely lifetime-wrangling.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lints.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/lints.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lints.rs b/compiler/rustc_pattern_analysis/src/lints.rs
index 6e5b0b04e1c..cb712fe640c 100644
--- a/compiler/rustc_pattern_analysis/src/lints.rs
+++ b/compiler/rustc_pattern_analysis/src/lints.rs
@@ -203,7 +203,7 @@ pub(crate) fn lint_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
                 };
 
                 use rustc_errors::DecorateLint;
-                let mut err = rcx.tcx.dcx().struct_span_warn(*arm.pat.data().unwrap(), "");
+                let mut err = rcx.tcx.dcx().struct_span_warn(arm.pat.data().unwrap().span, "");
                 err.set_primary_message(decorator.msg());
                 decorator.decorate_lint(&mut err);
                 err.emit();
@@ -254,7 +254,7 @@ pub(crate) fn lint_overlapping_range_endpoints<'a, 'p, 'tcx>(
                 // Iterate on patterns that contained `overlap`.
                 for pat in column.iter() {
                     let Constructor::IntRange(this_range) = pat.ctor() else { continue };
-                    let this_span = *pat.data().unwrap();
+                    let this_span = pat.data().unwrap().span;
                     if this_range.is_singleton() {
                         // Don't lint when one of the ranges is a singleton.
                         continue;