Skip to content

Commit

Permalink
Rename PatternContext to PatCtxt
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Sep 26, 2019
1 parent 5fbc211 commit d556193
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/librustc_mir/hair/pattern/_match.rs
Expand Up @@ -476,7 +476,7 @@ pub enum WitnessPreference {
}

#[derive(Copy, Clone, Debug)]
struct PatternContext<'tcx> {
struct PatCtxt<'tcx> {
ty: Ty<'tcx>,
max_slice_length: u64,
}
Expand Down Expand Up @@ -636,7 +636,7 @@ impl<'tcx> Witness<'tcx> {
/// `Option<!>`, we do not include `Some(_)` in the returned list of constructors.
fn all_constructors<'a, 'tcx>(
cx: &mut MatchCheckCtxt<'a, 'tcx>,
pcx: PatternContext<'tcx>,
pcx: PatCtxt<'tcx>,
) -> Vec<Constructor<'tcx>> {
debug!("all_constructors({:?})", pcx.ty);
let ctors = match pcx.ty.kind {
Expand Down Expand Up @@ -1094,7 +1094,7 @@ pub fn is_useful<'p, 'a, 'tcx>(

assert!(rows.iter().all(|r| r.len() == v.len()));

let pcx = PatternContext {
let pcx = PatCtxt {
// TyErr is used to represent the type of wildcard patterns matching
// against inaccessible (private) fields of structs, so that we won't
// be able to observe whether the types of the struct's fields are
Expand Down Expand Up @@ -1326,7 +1326,7 @@ fn is_useful_specialized<'p, 'a, 'tcx>(
/// Returns `None` in case of a catch-all, which can't be specialized.
fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt<'_, 'tcx>,
pat: &Pattern<'tcx>,
pcx: PatternContext<'tcx>)
pcx: PatCtxt<'tcx>)
-> Option<Vec<Constructor<'tcx>>>
{
match *pat.kind {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/hair/pattern/check_match.rs
Expand Up @@ -2,7 +2,7 @@ use super::_match::{MatchCheckCtxt, Matrix, expand_pattern, is_useful};
use super::_match::Usefulness::*;
use super::_match::WitnessPreference::*;

use super::{Pattern, PatternContext, PatternError, PatKind};
use super::{Pattern, PatCtxt, PatternError, PatKind};

use rustc::middle::borrowck::SignalledError;
use rustc::session::Session;
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, 'tcx> {
}
}

impl PatternContext<'_, '_> {
impl PatCtxt<'_, '_> {
fn report_inlining_errors(&self, pat_span: Span) {
for error in &self.errors {
match *error {
Expand Down Expand Up @@ -152,7 +152,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {

let inlined_arms : Vec<(Vec<_>, _)> = arms.iter().map(|arm| (
arm.top_pats_hack().iter().map(|pat| {
let mut patcx = PatternContext::new(self.tcx,
let mut patcx = PatCtxt::new(self.tcx,
self.param_env.and(self.identity_substs),
self.tables);
patcx.include_lint_checks();
Expand Down Expand Up @@ -249,7 +249,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) {
let module = self.tcx.hir().get_module_parent(pat.hir_id);
MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| {
let mut patcx = PatternContext::new(self.tcx,
let mut patcx = PatCtxt::new(self.tcx,
self.param_env.and(self.identity_substs),
self.tables);
patcx.include_lint_checks();
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_mir/hair/pattern/mod.rs
Expand Up @@ -347,7 +347,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> {
}
}

pub struct PatternContext<'a, 'tcx> {
pub struct PatCtxt<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>,
pub param_env: ty::ParamEnv<'tcx>,
pub tables: &'a ty::TypeckTables<'tcx>,
Expand All @@ -363,7 +363,7 @@ impl<'a, 'tcx> Pattern<'tcx> {
tables: &'a ty::TypeckTables<'tcx>,
pat: &'tcx hir::Pat,
) -> Self {
let mut pcx = PatternContext::new(tcx, param_env_and_substs, tables);
let mut pcx = PatCtxt::new(tcx, param_env_and_substs, tables);
let result = pcx.lower_pattern(pat);
if !pcx.errors.is_empty() {
let msg = format!("encountered errors lowering pattern: {:?}", pcx.errors);
Expand All @@ -374,13 +374,13 @@ impl<'a, 'tcx> Pattern<'tcx> {
}
}

impl<'a, 'tcx> PatternContext<'a, 'tcx> {
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
pub fn new(
tcx: TyCtxt<'tcx>,
param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>,
tables: &'a ty::TypeckTables<'tcx>,
) -> Self {
PatternContext {
PatCtxt {
tcx,
param_env: param_env_and_substs.param_env,
tables,
Expand Down Expand Up @@ -1293,7 +1293,7 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
}
}

impl UserAnnotatedTyHelpers<'tcx> for PatternContext<'_, 'tcx> {
impl UserAnnotatedTyHelpers<'tcx> for PatCtxt<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
Expand Down

0 comments on commit d556193

Please sign in to comment.