Shrink some visibilities.
This commit is contained in:
parent
af128b0144
commit
f3a37ed574
2 changed files with 17 additions and 17 deletions
|
@ -66,11 +66,11 @@ struct Cx<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
thir: Thir<'tcx>,
|
thir: Thir<'tcx>,
|
||||||
|
|
||||||
pub(crate) param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
|
|
||||||
pub(crate) region_scope_tree: &'tcx region::ScopeTree,
|
region_scope_tree: &'tcx region::ScopeTree,
|
||||||
pub(crate) typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
||||||
pub(crate) rvalue_scopes: &'tcx RvalueScopes,
|
rvalue_scopes: &'tcx RvalueScopes,
|
||||||
|
|
||||||
/// When applying adjustments to the expression
|
/// When applying adjustments to the expression
|
||||||
/// with the given `HirId`, use the given `Span`,
|
/// with the given `HirId`, use the given `Span`,
|
||||||
|
@ -100,7 +100,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub(crate) fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Box<Pat<'tcx>> {
|
fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Box<Pat<'tcx>> {
|
||||||
let p = match self.tcx.hir().get(p.hir_id) {
|
let p = match self.tcx.hir().get(p.hir_id) {
|
||||||
Node::Pat(p) => p,
|
Node::Pat(p) => p,
|
||||||
node => bug!("pattern became {:?}", node),
|
node => bug!("pattern became {:?}", node),
|
||||||
|
|
|
@ -29,22 +29,22 @@ use rustc_span::{Span, Symbol};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) enum PatternError {
|
enum PatternError {
|
||||||
AssocConstInPattern(Span),
|
AssocConstInPattern(Span),
|
||||||
ConstParamInPattern(Span),
|
ConstParamInPattern(Span),
|
||||||
StaticInPattern(Span),
|
StaticInPattern(Span),
|
||||||
NonConstPath(Span),
|
NonConstPath(Span),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct PatCtxt<'a, 'tcx> {
|
struct PatCtxt<'a, 'tcx> {
|
||||||
pub(crate) tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
pub(crate) param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
pub(crate) typeck_results: &'a ty::TypeckResults<'tcx>,
|
typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||||
pub(crate) errors: Vec<PatternError>,
|
errors: Vec<PatternError>,
|
||||||
include_lint_checks: bool,
|
include_lint_checks: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn pat_from_hir<'a, 'tcx>(
|
pub(super) fn pat_from_hir<'a, 'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
typeck_results: &'a ty::TypeckResults<'tcx>,
|
typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||||
|
@ -61,7 +61,7 @@ pub(crate) fn pat_from_hir<'a, 'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||||
pub(crate) fn new(
|
fn new(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
typeck_results: &'a ty::TypeckResults<'tcx>,
|
typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||||
|
@ -69,12 +69,12 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||||
PatCtxt { tcx, param_env, typeck_results, errors: vec![], include_lint_checks: false }
|
PatCtxt { tcx, param_env, typeck_results, errors: vec![], include_lint_checks: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn include_lint_checks(&mut self) -> &mut Self {
|
fn include_lint_checks(&mut self) -> &mut Self {
|
||||||
self.include_lint_checks = true;
|
self.include_lint_checks = true;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn lower_pattern(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> {
|
fn lower_pattern(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> {
|
||||||
// When implicit dereferences have been inserted in this pattern, the unadjusted lowered
|
// When implicit dereferences have been inserted in this pattern, the unadjusted lowered
|
||||||
// pattern has the type that results *after* dereferencing. For example, in this code:
|
// pattern has the type that results *after* dereferencing. For example, in this code:
|
||||||
//
|
//
|
||||||
|
@ -627,7 +627,7 @@ impl<'tcx> UserAnnotatedTyHelpers<'tcx> for PatCtxt<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait PatternFoldable<'tcx>: Sized {
|
trait PatternFoldable<'tcx>: Sized {
|
||||||
fn fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
|
fn fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
|
||||||
self.super_fold_with(folder)
|
self.super_fold_with(folder)
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ pub(crate) trait PatternFoldable<'tcx>: Sized {
|
||||||
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self;
|
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait PatternFolder<'tcx>: Sized {
|
trait PatternFolder<'tcx>: Sized {
|
||||||
fn fold_pattern(&mut self, pattern: &Pat<'tcx>) -> Pat<'tcx> {
|
fn fold_pattern(&mut self, pattern: &Pat<'tcx>) -> Pat<'tcx> {
|
||||||
pattern.super_fold_with(self)
|
pattern.super_fold_with(self)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue