use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::subst::InternalSubsts;
-use rustc_middle::ty::{self, List, TyCtxt, TypeFoldable};
+use rustc_middle::ty::{self, List, TyCtxt, TypeVisitable};
use rustc_span::Span;
use rustc_index::vec::{Idx, IndexVec};
}
impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> {
- fn visit_local(&mut self, &index: &Local, context: PlaceContext, location: Location) {
+ fn visit_local(&mut self, index: Local, context: PlaceContext, location: Location) {
debug!("visit_local: index={:?} context={:?} location={:?}", index, context, location);
// We're only interested in temporaries and the return place
match self.ccx.body.local_kind(index) {
Rvalue::Use(operand) | Rvalue::Repeat(operand, _) => {
self.validate_operand(operand)?;
}
+ Rvalue::CopyForDeref(place) => {
+ let op = &Operand::Copy(*place);
+ self.validate_operand(op)?
+ }
Rvalue::Discriminant(place) | Rvalue::Len(place) => {
self.validate_place(place.as_ref())?
literal: ConstantKind::from_const(_const, tcx),
}))
};
- let (blocks, local_decls) = self.source.basic_blocks_and_local_decls_mut();
+ let blocks = self.source.basic_blocks.as_mut();
+ let local_decls = &mut self.source.local_decls;
let loc = candidate.location;
let statement = &mut blocks[loc.block].statements[loc.statement_index];
match statement.kind {
Rvalue::Ref(ref mut region, borrow_kind, ref mut place),
)) => {
// Use the underlying local for this (necessarily interior) borrow.
- let ty = local_decls.local_decls()[place.local].ty;
+ let ty = local_decls[place.local].ty;
let span = statement.source_info.span;
let ref_ty = tcx.mk_ref(