Skip to content

Commit

Permalink
cmt_ -> Place
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 28, 2019
1 parent b5a6714 commit 85bb664
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/escape.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/loops.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/needless_pass_by_value.rs
Expand Up @@ -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 {
Expand All @@ -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, _) => {
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/utils/usage.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 85bb664

Please sign in to comment.