Skip to content

Commit a8187f8

Browse files
committed
Rename hir_id to lint_root.
1 parent 03a6ef6 commit a8187f8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl IntRange {
258258
pcx: &PatCtxt<'_, 'p, 'tcx>,
259259
pats: impl Iterator<Item = &'a DeconstructedPat<'p, 'tcx>>,
260260
column_count: usize,
261-
hir_id: HirId,
261+
lint_root: HirId,
262262
) {
263263
if self.is_singleton() {
264264
return;
@@ -290,7 +290,7 @@ impl IntRange {
290290
if !overlap.is_empty() {
291291
pcx.cx.tcx.emit_spanned_lint(
292292
lint::builtin::OVERLAPPING_RANGE_ENDPOINTS,
293-
hir_id,
293+
lint_root,
294294
pcx.span,
295295
OverlappingRangeEndpoints { overlap, range: pcx.span },
296296
);

compiler/rustc_mir_build/src/thir/pattern/usefulness.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,13 @@ impl<'p, 'tcx> Witness<'p, 'tcx> {
766766
/// `is_under_guard` is used to inform if the pattern has a guard. If it
767767
/// has one it must not be inserted into the matrix. This shouldn't be
768768
/// relied on for soundness.
769-
#[instrument(level = "debug", skip(cx, matrix, hir_id), ret)]
769+
#[instrument(level = "debug", skip(cx, matrix, lint_root), ret)]
770770
fn is_useful<'p, 'tcx>(
771771
cx: &MatchCheckCtxt<'p, 'tcx>,
772772
matrix: &Matrix<'p, 'tcx>,
773773
v: &PatStack<'p, 'tcx>,
774774
witness_preference: ArmType,
775-
hir_id: HirId,
775+
lint_root: HirId,
776776
is_under_guard: bool,
777777
is_top_level: bool,
778778
) -> Usefulness<'p, 'tcx> {
@@ -805,7 +805,7 @@ fn is_useful<'p, 'tcx>(
805805
for v in v.expand_or_pat() {
806806
debug!(?v);
807807
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)
809809
});
810810
debug!(?usefulness);
811811
ret.extend(usefulness);
@@ -838,7 +838,7 @@ fn is_useful<'p, 'tcx>(
838838
pcx,
839839
matrix.heads(),
840840
matrix.column_count().unwrap_or(0),
841-
hir_id,
841+
lint_root,
842842
)
843843
}
844844
// We split the head constructor of `v`.
@@ -853,7 +853,15 @@ fn is_useful<'p, 'tcx>(
853853
let spec_matrix = start_matrix.specialize_constructor(pcx, &ctor);
854854
let v = v.pop_head_constructor(pcx, &ctor);
855855
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+
)
857865
});
858866
let usefulness = usefulness.apply_constructor(pcx, start_matrix, &ctor);
859867

@@ -897,7 +905,7 @@ fn is_useful<'p, 'tcx>(
897905
// NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`.
898906
cx.tcx.emit_spanned_lint(
899907
NON_EXHAUSTIVE_OMITTED_PATTERNS,
900-
hir_id,
908+
lint_root,
901909
pcx.span,
902910
NonExhaustiveOmittedPattern {
903911
scrut_ty: pcx.ty,
@@ -955,7 +963,7 @@ pub(crate) struct UsefulnessReport<'p, 'tcx> {
955963
pub(crate) fn compute_match_usefulness<'p, 'tcx>(
956964
cx: &MatchCheckCtxt<'p, 'tcx>,
957965
arms: &[MatchArm<'p, 'tcx>],
958-
scrut_hir_id: HirId,
966+
lint_root: HirId,
959967
scrut_ty: Ty<'tcx>,
960968
) -> UsefulnessReport<'p, 'tcx> {
961969
let mut matrix = Matrix::empty();
@@ -980,7 +988,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>(
980988

981989
let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(scrut_ty));
982990
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);
984992
let non_exhaustiveness_witnesses = match usefulness {
985993
WithWitnesses(pats) => pats.into_iter().map(|w| w.single_pattern()).collect(),
986994
NoWitnesses { .. } => bug!(),

0 commit comments

Comments
 (0)