cmt_ -> Place

This commit is contained in:
Manish Goregaokar 2019-11-28 07:09:02 -08:00
parent b5a6714155
commit 85bb66480c
4 changed files with 17 additions and 17 deletions

View File

@ -2,7 +2,7 @@ use rustc::hir::intravisit as visit;
use rustc::hir::{self, *};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::middle::expr_use_visitor::*;
use rustc::middle::mem_categorization::{cmt_, Categorization};
use rustc::middle::mem_categorization::{Place, Categorization};
use rustc::ty::layout::LayoutOf;
use rustc::ty::{self, Ty};
use rustc::util::nodemap::HirIdSet;
@ -105,7 +105,7 @@ fn is_argument(map: &hir::map::Map<'_>, id: HirId) -> bool {
}
impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
fn consume(&mut self, cmt: &cmt_<'tcx>, mode: ConsumeMode) {
fn consume(&mut self, cmt: &Place<'tcx>, mode: ConsumeMode) {
if let Categorization::Local(lid) = cmt.cat {
if let ConsumeMode::Move = mode {
// moved out or in. clearly can't be localized
@ -125,13 +125,13 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
}
}
fn borrow(&mut self, cmt: &cmt_<'tcx>, _: ty::BorrowKind) {
fn borrow(&mut self, cmt: &Place<'tcx>, _: ty::BorrowKind) {
if let Categorization::Local(lid) = cmt.cat {
self.set.remove(&lid);
}
}
fn mutate(&mut self, cmt: &cmt_<'tcx>) {
fn mutate(&mut self, cmt: &Place<'tcx>) {
let map = &self.cx.tcx.hir();
if is_argument(map, cmt.hir_id) {
// Skip closure arguments

View File

@ -13,7 +13,7 @@ use crate::consts::{constant, Constant};
use crate::utils::usage::mutated_variables;
use crate::utils::{is_type_diagnostic_item, qpath_res, sext, sugg};
use rustc::middle::expr_use_visitor::*;
use rustc::middle::mem_categorization::cmt_;
use rustc::middle::mem_categorization::Place;
use rustc::middle::mem_categorization::Categorization;
use rustc::ty::subst::Subst;
use rustc::ty::{self, Ty};
@ -1586,9 +1586,9 @@ struct MutatePairDelegate {
}
impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
fn consume(&mut self, _: &cmt_<'tcx>, _: ConsumeMode) {}
fn consume(&mut self, _: &Place<'tcx>, _: ConsumeMode) {}
fn borrow(&mut self, cmt: &cmt_<'tcx>, bk: ty::BorrowKind) {
fn borrow(&mut self, cmt: &Place<'tcx>, bk: ty::BorrowKind) {
if let ty::BorrowKind::MutBorrow = bk {
if let Categorization::Local(id) = cmt.cat {
if Some(id) == self.hir_id_low {
@ -1601,7 +1601,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
}
}
fn mutate(&mut self, cmt: &cmt_<'tcx>) {
fn mutate(&mut self, cmt: &Place<'tcx>) {
if let Categorization::Local(id) = cmt.cat {
if Some(id) == self.hir_id_low {
self.span_low = Some(cmt.span)

View File

@ -326,7 +326,7 @@ struct MovedVariablesCtxt {
}
impl MovedVariablesCtxt {
fn move_common(&mut self, cmt: &mc::cmt_<'_>) {
fn move_common(&mut self, cmt: &mc::Place<'_>) {
let cmt = unwrap_downcast_or_interior(cmt);
if let mc::Categorization::Local(vid) = cmt.cat {
@ -336,18 +336,18 @@ impl MovedVariablesCtxt {
}
impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
fn consume(&mut self, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode) {
fn consume(&mut self, cmt: &mc::Place<'tcx>, mode: euv::ConsumeMode) {
if let euv::ConsumeMode::Move = mode {
self.move_common(cmt);
}
}
fn borrow(&mut self, _: &mc::cmt_<'tcx>, _: ty::BorrowKind) {}
fn borrow(&mut self, _: &mc::Place<'tcx>, _: ty::BorrowKind) {}
fn mutate(&mut self, _: &mc::cmt_<'tcx>) {}
fn mutate(&mut self, _: &mc::Place<'tcx>) {}
}
fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a mc::cmt_<'tcx>) -> mc::cmt_<'tcx> {
fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a mc::Place<'tcx>) -> mc::Place<'tcx> {
loop {
match cmt.cat {
mc::Categorization::Downcast(ref c, _) | mc::Categorization::Interior(ref c, _) => {

View File

@ -2,7 +2,7 @@ use rustc::hir::def::Res;
use rustc::hir::*;
use rustc::lint::LateContext;
use rustc::middle::expr_use_visitor::*;
use rustc::middle::mem_categorization::cmt_;
use rustc::middle::mem_categorization::Place;
use rustc::middle::mem_categorization::Categorization;
use rustc::ty;
use rustc_data_structures::fx::FxHashSet;
@ -64,15 +64,15 @@ impl<'tcx> MutVarsDelegate {
}
impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
fn consume(&mut self, _: &cmt_<'tcx>, _: ConsumeMode) {}
fn consume(&mut self, _: &Place<'tcx>, _: ConsumeMode) {}
fn borrow(&mut self, cmt: &cmt_<'tcx>, bk: ty::BorrowKind) {
fn borrow(&mut self, cmt: &Place<'tcx>, bk: ty::BorrowKind) {
if let ty::BorrowKind::MutBorrow = bk {
self.update(&cmt.cat)
}
}
fn mutate(&mut self, cmt: &cmt_<'tcx>) {
fn mutate(&mut self, cmt: &Place<'tcx>) {
self.update(&cmt.cat)
}
}