1
Fork 0

Name rustc-specific things "rustc"

This commit is contained in:
Nadrieril 2023-12-11 20:15:52 +01:00
parent 3d7c4df326
commit cb622f3994
6 changed files with 42 additions and 48 deletions

View file

@ -8,14 +8,13 @@ use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
use rustc_span::Span;
use crate::constructor::{IntRange, MaybeInfiniteInt};
use crate::cx::{
Constructor, DeconstructedPat, MatchArm, MatchCheckCtxt, PatCtxt, SplitConstructorSet,
WitnessPat,
};
use crate::errors::{
NonExhaustiveOmittedPattern, NonExhaustiveOmittedPatternLintOnArm, Overlap,
OverlappingRangeEndpoints, Uncovered,
};
use crate::rustc::{
Constructor, DeconstructedPat, MatchArm, PatCtxt, RustcCtxt, SplitConstructorSet, WitnessPat,
};
use crate::MatchCx;
/// A column of patterns in the matrix, where a column is the intuitive notion of "subpatterns that
@ -56,10 +55,10 @@ impl<'a, 'p, 'tcx> PatternColumn<'a, 'p, 'tcx> {
// If the type is opaque and it is revealed anywhere in the column, we take the revealed
// version. Otherwise we could encounter constructors for the revealed type and crash.
let first_ty = self.patterns[0].ty();
if MatchCheckCtxt::is_opaque_ty(first_ty) {
if RustcCtxt::is_opaque_ty(first_ty) {
for pat in &self.patterns {
let ty = pat.ty();
if !MatchCheckCtxt::is_opaque_ty(ty) {
if !RustcCtxt::is_opaque_ty(ty) {
return Some(ty);
}
}
@ -126,7 +125,7 @@ impl<'a, 'p, 'tcx> PatternColumn<'a, 'p, 'tcx> {
/// in a given column.
#[instrument(level = "debug", skip(cx, wildcard_arena), ret)]
fn collect_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
cx: &RustcCtxt<'p, 'tcx>,
column: &PatternColumn<'a, 'p, 'tcx>,
wildcard_arena: &TypedArena<DeconstructedPat<'p, 'tcx>>,
) -> Vec<WitnessPat<'p, 'tcx>> {
@ -174,7 +173,7 @@ fn collect_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
}
pub(crate) fn lint_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
cx: &RustcCtxt<'p, 'tcx>,
arms: &[MatchArm<'p, 'tcx>],
pat_column: &PatternColumn<'a, 'p, 'tcx>,
scrut_ty: Ty<'tcx>,
@ -228,7 +227,7 @@ pub(crate) fn lint_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
/// Traverse the patterns to warn the user about ranges that overlap on their endpoints.
#[instrument(level = "debug", skip(cx, wildcard_arena))]
pub(crate) fn lint_overlapping_range_endpoints<'a, 'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
cx: &RustcCtxt<'p, 'tcx>,
column: &PatternColumn<'a, 'p, 'tcx>,
wildcard_arena: &TypedArena<DeconstructedPat<'p, 'tcx>>,
) {