Skip to content

Commit 34ad52e

Browse files
committed
pat_constructor does not need pcx anymore
1 parent 3531c52 commit 34ad52e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/librustc_mir/hair/pattern/_match.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ pub fn is_useful<'p, 'a, 'tcx>(
16321632

16331633
debug!("is_useful_expand_first_col: pcx={:#?}, expanding {:#?}", pcx, v.head());
16341634

1635-
if let Some(constructor) = pat_constructor(cx, v.head(), pcx) {
1635+
if let Some(constructor) = pat_constructor(cx, v.head()) {
16361636
debug!("is_useful - expanding constructor: {:#?}", constructor);
16371637
split_grouped_constructors(
16381638
cx.tcx,
@@ -1651,7 +1651,7 @@ pub fn is_useful<'p, 'a, 'tcx>(
16511651
debug!("is_useful - expanding wildcard");
16521652

16531653
let used_ctors: Vec<Constructor<'_>> =
1654-
matrix.heads().filter_map(|p| pat_constructor(cx, p, pcx)).collect();
1654+
matrix.heads().filter_map(|p| pat_constructor(cx, p)).collect();
16551655
debug!("used_ctors = {:#?}", used_ctors);
16561656
// `all_ctors` are all the constructors for the given type, which
16571657
// should all be represented (or caught with the wild pattern `_`).
@@ -1756,10 +1756,9 @@ fn is_useful_specialized<'p, 'a, 'tcx>(
17561756
fn pat_constructor<'tcx>(
17571757
cx: &mut MatchCheckCtxt<'_, 'tcx>,
17581758
pat: &Pat<'tcx>,
1759-
pcx: PatCtxt<'tcx>,
17601759
) -> Option<Constructor<'tcx>> {
17611760
match *pat.kind {
1762-
PatKind::AscribeUserType { ref subpattern, .. } => pat_constructor(cx, subpattern, pcx),
1761+
PatKind::AscribeUserType { ref subpattern, .. } => pat_constructor(cx, subpattern),
17631762
PatKind::Binding { .. } | PatKind::Wild => None,
17641763
PatKind::Leaf { .. } | PatKind::Deref { .. } => Some(Single),
17651764
PatKind::Variant { adt_def, variant_index, .. } => {
@@ -1773,9 +1772,9 @@ fn pat_constructor<'tcx>(
17731772
end,
17741773
pat.span,
17751774
)),
1776-
PatKind::Array { .. } => match pcx.ty.kind {
1775+
PatKind::Array { .. } => match pat.ty.kind {
17771776
ty::Array(_, length) => Some(FixedLenSlice(length.eval_usize(cx.tcx, cx.param_env))),
1778-
_ => span_bug!(pat.span, "bad ty {:?} for array pattern", pcx.ty),
1777+
_ => span_bug!(pat.span, "bad ty {:?} for array pattern", pat.ty),
17791778
},
17801779
PatKind::Slice { ref prefix, ref slice, ref suffix } => {
17811780
let prefix = prefix.len() as u64;

0 commit comments

Comments
 (0)