}
let span = local_decl.source_info.span;
- let mut_span = tcx.sess.codemap().span_until_non_whitespace(span);
+ let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
let mut err = tcx.struct_span_lint_node(
UNUSED_MUT,
// individual fields instead. This way if `foo` has a
// destructor but `bar` does not, we will only check for
// borrows of `x.foo` and not `x.bar`. See #47703.
- ty::TyAdt(def, substs) if def.is_struct() && !def.has_dtor(self.tcx) => {
+ ty::Adt(def, substs) if def.is_struct() && !def.has_dtor(self.tcx) => {
def.all_fields()
.map(|field| field.ty(gcx, substs))
.enumerate()
.for_each(|field| drop_field(self, field));
}
// Same as above, but for tuples.
- ty::TyTuple(tys) => {
+ ty::Tuple(tys) => {
tys.iter()
.cloned()
.enumerate()
}
// Closures also have disjoint fields, but they are only
// directly accessed in the body of the closure.
- ty::TyClosure(def, substs)
+ ty::Closure(def, substs)
if *drop_place == Place::Local(Local::new(1))
&& !self.mir.upvar_decls.is_empty() =>
{
}
// Generators also have disjoint fields, but they are only
// directly accessed in the body of the generator.
- ty::TyGenerator(def, substs, _)
+ ty::Generator(def, substs, _)
if *drop_place == Place::Local(Local::new(1))
&& !self.mir.upvar_decls.is_empty() =>
{
// the base case below, we would have a Deep Write due to
// the box being `needs_drop`, and that Deep Write would
// touch `&mut` data in the box.
- ty::TyAdt(def, _) if def.is_box() => {
+ ty::Adt(def, _) if def.is_box() => {
// When/if we add a `&own T` type, this action would
// be like running the destructor of the `&own T`.
// (And the owner of backing storage referenced by the
}
}
- if self
+ // Check is_empty() first because it's the common case, and doing that
+ // way we avoid the clone() call.
+ if !self.access_place_error_reported.is_empty() &&
+ self
.access_place_error_reported
.contains(&(place_span.0.clone(), place_span.1))
{
debug!("check_for_invalidation_at_exit({:?}): INVALID", place);
// FIXME: should be talking about the region lifetime instead
// of just a span here.
- let span = self.tcx.sess.codemap().end_point(span);
+ let span = self.tcx.sess.source_map().end_point(span);
self.report_borrowed_value_does_not_live_long_enough(
context,
borrow,
// be already initialized
let tcx = self.tcx;
match base.ty(self.mir, tcx).to_ty(tcx).sty {
- ty::TyAdt(def, _) if def.has_dtor(tcx) => {
+ ty::Adt(def, _) if def.has_dtor(tcx) => {
// FIXME: analogous code in
// check_loans.rs first maps
// Check the kind of deref to decide
match base_ty.sty {
- ty::TyRef(_, _, mutbl) => {
+ ty::Ref(_, _, mutbl) => {
match mutbl {
// Shared borrowed data is never mutable
hir::MutImmutable => Err(place),
}
}
}
- ty::TyRawPtr(tnm) => {
+ ty::RawPtr(tnm) => {
match tnm.mutbl {
// `*const` raw pointers are not mutable
hir::MutImmutable => return Err(place),