@@ -766,13 +766,13 @@ impl<'p, 'tcx> Witness<'p, 'tcx> {
766
766
/// `is_under_guard` is used to inform if the pattern has a guard. If it
767
767
/// has one it must not be inserted into the matrix. This shouldn't be
768
768
/// relied on for soundness.
769
- #[instrument(level = "debug", skip(cx, matrix, hir_id ), ret)]
769
+ #[instrument(level = "debug", skip(cx, matrix, lint_root ), ret)]
770
770
fn is_useful<'p, 'tcx>(
771
771
cx: &MatchCheckCtxt<'p, 'tcx>,
772
772
matrix: &Matrix<'p, 'tcx>,
773
773
v: &PatStack<'p, 'tcx>,
774
774
witness_preference: ArmType,
775
- hir_id : HirId,
775
+ lint_root : HirId,
776
776
is_under_guard: bool,
777
777
is_top_level: bool,
778
778
) -> Usefulness<'p, 'tcx> {
@@ -805,7 +805,7 @@ fn is_useful<'p, 'tcx>(
805
805
for v in v.expand_or_pat() {
806
806
debug!(?v);
807
807
let usefulness = ensure_sufficient_stack(|| {
808
- is_useful(cx, &matrix, &v, witness_preference, hir_id , is_under_guard, false)
808
+ is_useful(cx, &matrix, &v, witness_preference, lint_root , is_under_guard, false)
809
809
});
810
810
debug!(?usefulness);
811
811
ret.extend(usefulness);
@@ -838,7 +838,7 @@ fn is_useful<'p, 'tcx>(
838
838
pcx,
839
839
matrix.heads(),
840
840
matrix.column_count().unwrap_or(0),
841
- hir_id ,
841
+ lint_root ,
842
842
)
843
843
}
844
844
// We split the head constructor of `v`.
@@ -853,7 +853,15 @@ fn is_useful<'p, 'tcx>(
853
853
let spec_matrix = start_matrix.specialize_constructor(pcx, &ctor);
854
854
let v = v.pop_head_constructor(pcx, &ctor);
855
855
let usefulness = ensure_sufficient_stack(|| {
856
- is_useful(cx, &spec_matrix, &v, witness_preference, hir_id, is_under_guard, false)
856
+ is_useful(
857
+ cx,
858
+ &spec_matrix,
859
+ &v,
860
+ witness_preference,
861
+ lint_root,
862
+ is_under_guard,
863
+ false,
864
+ )
857
865
});
858
866
let usefulness = usefulness.apply_constructor(pcx, start_matrix, &ctor);
859
867
@@ -897,7 +905,7 @@ fn is_useful<'p, 'tcx>(
897
905
// NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`.
898
906
cx.tcx.emit_spanned_lint(
899
907
NON_EXHAUSTIVE_OMITTED_PATTERNS,
900
- hir_id ,
908
+ lint_root ,
901
909
pcx.span,
902
910
NonExhaustiveOmittedPattern {
903
911
scrut_ty: pcx.ty,
@@ -955,7 +963,7 @@ pub(crate) struct UsefulnessReport<'p, 'tcx> {
955
963
pub(crate) fn compute_match_usefulness<'p, 'tcx>(
956
964
cx: &MatchCheckCtxt<'p, 'tcx>,
957
965
arms: &[MatchArm<'p, 'tcx>],
958
- scrut_hir_id : HirId,
966
+ lint_root : HirId,
959
967
scrut_ty: Ty<'tcx>,
960
968
) -> UsefulnessReport<'p, 'tcx> {
961
969
let mut matrix = Matrix::empty();
@@ -980,7 +988,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>(
980
988
981
989
let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(scrut_ty));
982
990
let v = PatStack::from_pattern(wild_pattern);
983
- let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, scrut_hir_id , false, true);
991
+ let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, lint_root , false, true);
984
992
let non_exhaustiveness_witnesses = match usefulness {
985
993
WithWitnesses(pats) => pats.into_iter().map(|w| w.single_pattern()).collect(),
986
994
NoWitnesses { .. } => bug!(),
0 commit comments