Skip to content

Commit ce45b48

Browse files
committed
Address review comments
1 parent 44cd4d1 commit ce45b48

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

compiler/rustc_pattern_analysis/src/constructor.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ pub struct IntRange {
266266

267267
impl IntRange {
268268
/// Best effort; will not know that e.g. `255u8..` is a singleton.
269-
#[cfg_attr(not(feature = "rustc"), allow(dead_code))]
270-
pub(crate) fn is_singleton(&self) -> bool {
269+
pub fn is_singleton(&self) -> bool {
271270
// Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite
272271
// to infinite, this correctly only detects ranges that contain exacly one `Finite(x)`.
273272
self.lo.plus_one() == self.hi

compiler/rustc_pattern_analysis/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,8 @@ pub struct MatchArm<'p, Cx: MatchCx> {
7979

8080
impl<'p, Cx: MatchCx> Copy for MatchArm<'p, Cx> {}
8181

82-
#[cfg(not(feature = "rustc"))]
8382
pub trait Captures<'a> {}
84-
#[cfg(not(feature = "rustc"))]
8583
impl<'a, T: ?Sized> Captures<'a> for T {}
86-
#[cfg(feature = "rustc")]
87-
pub use rustc_data_structures::captures::Captures;
8884

8985
/// The entrypoint for this crate. Computes whether a match is exhaustive and which of its arms are
9086
/// useful, and runs some lints.

compiler/rustc_pattern_analysis/src/lints.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,11 @@ impl<'a, 'p, 'tcx> PatternColumn<'a, 'p, 'tcx> {
8282
/// This returns one column per field of the constructor. They usually all have the same length
8383
/// (the number of patterns in `self` that matched `ctor`), except that we expand or-patterns
8484
/// which may change the lengths.
85-
fn specialize<'b>(
85+
fn specialize(
8686
&self,
87-
pcx: &'b PatCtxt<'_, 'p, 'tcx>,
87+
pcx: &PatCtxt<'a, 'p, 'tcx>,
8888
ctor: &Constructor<'p, 'tcx>,
89-
) -> Vec<PatternColumn<'b, 'p, 'tcx>>
90-
where
91-
'a: 'b,
92-
{
89+
) -> Vec<PatternColumn<'a, 'p, 'tcx>> {
9390
let arity = ctor.arity(pcx);
9491
if arity == 0 {
9592
return Vec::new();

0 commit comments

Comments
 (0)