]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/escape.rs
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / escape.rs
index 7227683aa5ac2c0104f1a535c1bbbdbb641da55b..77e90eeac49589ecfcdfcb1c9488f61dc54fe832 100644 (file)
@@ -6,7 +6,7 @@
 use rustc_session::{declare_tool_lint, impl_lint_pass};
 use rustc_span::source_map::Span;
 use rustc_target::abi::LayoutOf;
-use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};
+use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
 
 use crate::utils::span_lint;
 
@@ -112,9 +112,9 @@ fn is_argument(map: rustc_middle::hir::map::Map<'_>, id: HirId) -> bool {
 }
 
 impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
-    fn consume(&mut self, cmt: &Place<'tcx>, mode: ConsumeMode) {
-        if cmt.projections.is_empty() {
-            if let PlaceBase::Local(lid) = cmt.base {
+    fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, mode: ConsumeMode) {
+        if cmt.place.projections.is_empty() {
+            if let PlaceBase::Local(lid) = cmt.place.base {
                 if let ConsumeMode::Move = mode {
                     // moved out or in. clearly can't be localized
                     self.set.remove(&lid);
@@ -132,16 +132,16 @@ fn consume(&mut self, cmt: &Place<'tcx>, mode: ConsumeMode) {
         }
     }
 
-    fn borrow(&mut self, cmt: &Place<'tcx>, _: ty::BorrowKind) {
-        if cmt.projections.is_empty() {
-            if let PlaceBase::Local(lid) = cmt.base {
+    fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: ty::BorrowKind) {
+        if cmt.place.projections.is_empty() {
+            if let PlaceBase::Local(lid) = cmt.place.base {
                 self.set.remove(&lid);
             }
         }
     }
 
-    fn mutate(&mut self, cmt: &Place<'tcx>) {
-        if cmt.projections.is_empty() {
+    fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>) {
+        if cmt.place.projections.is_empty() {
             let map = &self.cx.tcx.hir();
             if is_argument(*map, cmt.hir_id) {
                 // Skip closure arguments
@@ -150,7 +150,7 @@ fn mutate(&mut self, cmt: &Place<'tcx>) {
                     return;
                 }
 
-                if is_non_trait_box(cmt.ty) && !self.is_large_box(cmt.ty) {
+                if is_non_trait_box(cmt.place.ty) && !self.is_large_box(cmt.place.ty) {
                     self.set.insert(cmt.hir_id);
                 }
                 return;