From 8c5e89907c1f6312c8613b5d6851381bbcde8052 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 14 Dec 2023 17:58:33 +0100 Subject: [PATCH] Address review comments --- compiler/rustc_pattern_analysis/src/constructor.rs | 3 +-- compiler/rustc_pattern_analysis/src/lib.rs | 4 ---- compiler/rustc_pattern_analysis/src/lints.rs | 9 +++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 65312228801..2093c511032 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -266,8 +266,7 @@ pub struct IntRange { impl IntRange { /// Best effort; will not know that e.g. `255u8..` is a singleton. - #[cfg_attr(not(feature = "rustc"), allow(dead_code))] - pub(crate) fn is_singleton(&self) -> bool { + pub fn is_singleton(&self) -> bool { // Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite // to infinite, this correctly only detects ranges that contain exacly one `Finite(x)`. self.lo.plus_one() == self.hi diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 3e2599858af..36ec86eb5b3 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -79,12 +79,8 @@ pub struct MatchArm<'p, Cx: MatchCx> { impl<'p, Cx: MatchCx> Copy for MatchArm<'p, Cx> {} -#[cfg(not(feature = "rustc"))] pub trait Captures<'a> {} -#[cfg(not(feature = "rustc"))] impl<'a, T: ?Sized> Captures<'a> for T {} -#[cfg(feature = "rustc")] -pub use rustc_data_structures::captures::Captures; /// The entrypoint for this crate. Computes whether a match is exhaustive and which of its arms are /// useful, and runs some lints. diff --git a/compiler/rustc_pattern_analysis/src/lints.rs b/compiler/rustc_pattern_analysis/src/lints.rs index 38108b62d79..2391dd9096e 100644 --- a/compiler/rustc_pattern_analysis/src/lints.rs +++ b/compiler/rustc_pattern_analysis/src/lints.rs @@ -82,14 +82,11 @@ impl<'a, 'p, 'tcx> PatternColumn<'a, 'p, 'tcx> { /// This returns one column per field of the constructor. They usually all have the same length /// (the number of patterns in `self` that matched `ctor`), except that we expand or-patterns /// which may change the lengths. - fn specialize<'b>( + fn specialize( &self, - pcx: &'b PatCtxt<'_, 'p, 'tcx>, + pcx: &PatCtxt<'a, 'p, 'tcx>, ctor: &Constructor<'p, 'tcx>, - ) -> Vec> - where - 'a: 'b, - { + ) -> Vec> { let arity = ctor.arity(pcx); if arity == 0 { return Vec::new();