1
Fork 0

Auto merge of #87424 - RalfJung:const-check, r=oli-obk

rename const checking visitor module to check_consts::check

This avoids naming ambiguities with "const validation" which is in `interpret/validity.rs` and checks *values*.

r? `@oli-obk`
This commit is contained in:
bors 2021-07-26 03:10:42 +00:00
commit 3bcce82d14
4 changed files with 8 additions and 8 deletions

View file

@ -180,7 +180,7 @@ impl Qualifs<'mir, 'tcx> {
} }
} }
pub struct Validator<'mir, 'tcx> { pub struct Checker<'mir, 'tcx> {
ccx: &'mir ConstCx<'mir, 'tcx>, ccx: &'mir ConstCx<'mir, 'tcx>,
qualifs: Qualifs<'mir, 'tcx>, qualifs: Qualifs<'mir, 'tcx>,
@ -194,7 +194,7 @@ pub struct Validator<'mir, 'tcx> {
secondary_errors: Vec<Diagnostic>, secondary_errors: Vec<Diagnostic>,
} }
impl Deref for Validator<'mir, 'tcx> { impl Deref for Checker<'mir, 'tcx> {
type Target = ConstCx<'mir, 'tcx>; type Target = ConstCx<'mir, 'tcx>;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
@ -202,9 +202,9 @@ impl Deref for Validator<'mir, 'tcx> {
} }
} }
impl Validator<'mir, 'tcx> { impl Checker<'mir, 'tcx> {
pub fn new(ccx: &'mir ConstCx<'mir, 'tcx>) -> Self { pub fn new(ccx: &'mir ConstCx<'mir, 'tcx>) -> Self {
Validator { Checker {
span: ccx.body.span, span: ccx.body.span,
ccx, ccx,
qualifs: Default::default(), qualifs: Default::default(),
@ -477,7 +477,7 @@ impl Validator<'mir, 'tcx> {
} }
} }
impl Visitor<'tcx> for Validator<'mir, 'tcx> { impl Visitor<'tcx> for Checker<'mir, 'tcx> {
fn visit_basic_block_data(&mut self, bb: BasicBlock, block: &BasicBlockData<'tcx>) { fn visit_basic_block_data(&mut self, bb: BasicBlock, block: &BasicBlockData<'tcx>) {
trace!("visit_basic_block_data: bb={:?} is_cleanup={:?}", bb, block.is_cleanup); trace!("visit_basic_block_data: bb={:?} is_cleanup={:?}", bb, block.is_cleanup);

View file

@ -13,11 +13,11 @@ use rustc_span::Symbol;
pub use self::qualifs::Qualif; pub use self::qualifs::Qualif;
pub mod check;
mod ops; mod ops;
pub mod post_drop_elaboration; pub mod post_drop_elaboration;
pub mod qualifs; pub mod qualifs;
mod resolver; mod resolver;
pub mod validation;
/// Information about the item currently being const-checked, as well as a reference to the global /// Information about the item currently being const-checked, as well as a reference to the global
/// context. /// context.

View file

@ -3,9 +3,9 @@ use rustc_middle::mir::{self, BasicBlock, Location};
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use rustc_span::Span; use rustc_span::Span;
use super::check::Qualifs;
use super::ops::{self, NonConstOp}; use super::ops::{self, NonConstOp};
use super::qualifs::{NeedsDrop, Qualif}; use super::qualifs::{NeedsDrop, Qualif};
use super::validation::Qualifs;
use super::ConstCx; use super::ConstCx;
/// Returns `true` if we should use the more precise live drop checker that runs after drop /// Returns `true` if we should use the more precise live drop checker that runs after drop

View file

@ -241,7 +241,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) ->
let ccx = check_consts::ConstCx { body, tcx, const_kind, param_env: tcx.param_env(def.did) }; let ccx = check_consts::ConstCx { body, tcx, const_kind, param_env: tcx.param_env(def.did) };
let mut validator = check_consts::validation::Validator::new(&ccx); let mut validator = check_consts::check::Checker::new(&ccx);
validator.check_body(); validator.check_body();
// We return the qualifs in the return place for every MIR body, even though it is only used // We return the qualifs in the return place for every MIR body, even though it is only used