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;
}
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);
}
}
- 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
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;