euv moved from middle to typeck

This commit is contained in:
Manish Goregaokar 2019-11-28 07:12:05 -08:00
parent 85bb66480c
commit dc9d839410
4 changed files with 9 additions and 15 deletions

View File

@ -1,8 +1,7 @@
use rustc::hir::intravisit as visit; use rustc::hir::intravisit as visit;
use rustc::hir::{self, *}; use rustc::hir::{self, *};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::middle::expr_use_visitor::*; use rustc_typeck::expr_use_visitor::*;
use rustc::middle::mem_categorization::{Place, Categorization};
use rustc::ty::layout::LayoutOf; use rustc::ty::layout::LayoutOf;
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use rustc::util::nodemap::HirIdSet; use rustc::util::nodemap::HirIdSet;

View File

@ -12,9 +12,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
use crate::consts::{constant, Constant}; use crate::consts::{constant, Constant};
use crate::utils::usage::mutated_variables; use crate::utils::usage::mutated_variables;
use crate::utils::{is_type_diagnostic_item, qpath_res, sext, sugg}; use crate::utils::{is_type_diagnostic_item, qpath_res, sext, sugg};
use rustc::middle::expr_use_visitor::*; use rustc_typeck::expr_use_visitor::*;
use rustc::middle::mem_categorization::Place;
use rustc::middle::mem_categorization::Categorization;
use rustc::ty::subst::Subst; use rustc::ty::subst::Subst;
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::fx::{FxHashMap, FxHashSet};

View File

@ -8,8 +8,7 @@ use matches::matches;
use rustc::hir::intravisit::FnKind; use rustc::hir::intravisit::FnKind;
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::middle::expr_use_visitor as euv; use rustc_typeck::expr_use_visitor as euv;
use rustc::middle::mem_categorization as mc;
use rustc::traits; use rustc::traits;
use rustc::ty::{self, RegionKind, TypeFoldable}; use rustc::ty::{self, RegionKind, TypeFoldable};
use rustc::{declare_lint_pass, declare_tool_lint}; use rustc::{declare_lint_pass, declare_tool_lint};
@ -326,7 +325,7 @@ struct MovedVariablesCtxt {
} }
impl MovedVariablesCtxt { impl MovedVariablesCtxt {
fn move_common(&mut self, cmt: &mc::Place<'_>) { fn move_common(&mut self, cmt: &euv::Place<'_>) {
let cmt = unwrap_downcast_or_interior(cmt); let cmt = unwrap_downcast_or_interior(cmt);
if let mc::Categorization::Local(vid) = cmt.cat { if let mc::Categorization::Local(vid) = cmt.cat {
@ -336,18 +335,18 @@ impl MovedVariablesCtxt {
} }
impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt { impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
fn consume(&mut self, cmt: &mc::Place<'tcx>, mode: euv::ConsumeMode) { fn consume(&mut self, cmt: &euv::Place<'tcx>, mode: euv::ConsumeMode) {
if let euv::ConsumeMode::Move = mode { if let euv::ConsumeMode::Move = mode {
self.move_common(cmt); self.move_common(cmt);
} }
} }
fn borrow(&mut self, _: &mc::Place<'tcx>, _: ty::BorrowKind) {} fn borrow(&mut self, _: &euv::Place<'tcx>, _: ty::BorrowKind) {}
fn mutate(&mut self, _: &mc::Place<'tcx>) {} fn mutate(&mut self, _: &euv::Place<'tcx>) {}
} }
fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a mc::Place<'tcx>) -> mc::Place<'tcx> { fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a euv::Place<'tcx>) -> euv::Place<'tcx> {
loop { loop {
match cmt.cat { match cmt.cat {
mc::Categorization::Downcast(ref c, _) | mc::Categorization::Interior(ref c, _) => { mc::Categorization::Downcast(ref c, _) | mc::Categorization::Interior(ref c, _) => {

View File

@ -1,9 +1,7 @@
use rustc::hir::def::Res; use rustc::hir::def::Res;
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::LateContext; use rustc::lint::LateContext;
use rustc::middle::expr_use_visitor::*; use rustc_typeck::expr_use_visitor::*;
use rustc::middle::mem_categorization::Place;
use rustc::middle::mem_categorization::Categorization;
use rustc::ty; use rustc::ty;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;