};
if is_consume {
let base_ty =
- mir::Place::ty_from(place_ref.local, proj_base, *self.fx.mir, cx.tcx());
+ mir::Place::ty_from(place_ref.local, proj_base, self.fx.mir, cx.tcx());
let base_ty = self.fx.monomorphize(&base_ty);
// ZSTs don't require any actual memory access.
target: mir::BasicBlock,
unwind: Option<mir::BasicBlock>,
) {
- let ty = location.ty(*self.mir, bx.tcx()).ty;
+ let ty = location.ty(self.mir, bx.tcx()).ty;
let ty = self.monomorphize(&ty);
let drop_fn = Instance::resolve_drop_in_place(bx.tcx(), ty);
let extra_args = extra_args
.iter()
.map(|op_arg| {
- let op_ty = op_arg.ty(*self.mir, bx.tcx());
+ let op_ty = op_arg.ty(self.mir, bx.tcx());
self.monomorphize(&op_ty)
})
.collect::<Vec<_>>();
pub fn monomorphized_place_ty(&self, place_ref: mir::PlaceRef<'tcx>) -> Ty<'tcx> {
let tcx = self.cx.tcx();
- let place_ty = mir::Place::ty_from(place_ref.local, place_ref.projection, *self.mir, tcx);
+ let place_ty = mir::Place::ty_from(place_ref.local, place_ref.projection, self.mir, tcx);
self.monomorphize(&place_ty.ty)
}
}
}
mir::Rvalue::Discriminant(ref place) => {
- let discr_ty = rvalue.ty(*self.mir, bx.tcx());
+ let discr_ty = rvalue.ty(self.mir, bx.tcx());
let discr = self
.codegen_place(&mut bx, place.as_ref())
.codegen_get_discr(&mut bx, discr_ty);
mir::Rvalue::Repeat(..) | mir::Rvalue::Aggregate(..) => {
// According to `rvalue_creates_operand`, only ZST
// aggregate rvalues are allowed to be operands.
- let ty = rvalue.ty(*self.mir, self.cx.tcx());
+ let ty = rvalue.ty(self.mir, self.cx.tcx());
let operand =
OperandRef::new_zst(&mut bx, self.cx.layout_of(self.monomorphize(&ty)));
(bx, operand)
true,
mir::Rvalue::Repeat(..) |
mir::Rvalue::Aggregate(..) => {
- let ty = rvalue.ty(*self.mir, self.cx.tcx());
+ let ty = rvalue.ty(self.mir, self.cx.tcx());
let ty = self.monomorphize(&ty);
self.cx.spanned_layout_of(ty, span).is_zst()
}
}
let ty =
- Place::ty_from(used_place.local, used_place.projection, *self.body, self.infcx.tcx)
+ Place::ty_from(used_place.local, used_place.projection, self.body, self.infcx.tcx)
.ty;
let needs_note = match ty.kind {
ty::Closure(id, _) => {
let mpi = self.move_data.moves[move_out_indices[0]].path;
let place = &self.move_data.move_paths[mpi].place;
- let ty = place.ty(*self.body, self.infcx.tcx).ty;
+ let ty = place.ty(self.body, self.infcx.tcx).ty;
let opt_name =
self.describe_place_with_options(place.as_ref(), IncludingDowncast(true));
let note_msg = match opt_name {
// Define a small closure that we can use to check if the type of a place
// is a union.
let union_ty = |place_base, place_projection| {
- let ty = Place::ty_from(place_base, place_projection, *self.body, self.infcx.tcx).ty;
+ let ty = Place::ty_from(place_base, place_projection, self.body, self.infcx.tcx).ty;
ty.ty_adt_def().filter(|adt| adt.is_union()).map(|_| ty)
};
StorageDeadOrDrop::LocalStorageDead
| StorageDeadOrDrop::BoxedStorageDead => {
assert!(
- Place::ty_from(place.local, proj_base, *self.body, tcx).ty.is_box(),
+ Place::ty_from(place.local, proj_base, self.body, tcx).ty.is_box(),
"Drop of value behind a reference or raw pointer"
);
StorageDeadOrDrop::BoxedStorageDead
StorageDeadOrDrop::Destructor(_) => base_access,
},
ProjectionElem::Field(..) | ProjectionElem::Downcast(..) => {
- let base_ty = Place::ty_from(place.local, proj_base, *self.body, tcx).ty;
+ let base_ty = Place::ty_from(place.local, proj_base, self.body, tcx).ty;
match base_ty.kind {
ty::Adt(def, _) if def.has_dtor(tcx) => {
// Report the outermost adt with a destructor
}
ProjectionElem::Downcast(_, variant_index) => {
let base_ty =
- Place::ty_from(place.local, place.projection, *self.body, self.infcx.tcx)
- .ty;
+ Place::ty_from(place.local, place.projection, self.body, self.infcx.tcx).ty;
self.describe_field_from_ty(&base_ty, field, Some(*variant_index))
}
ProjectionElem::Field(_, field_type) => {
}) = bbd.terminator
{
if let Some(source) =
- BorrowedContentSource::from_call(func.ty(*self.body, tcx), tcx)
+ BorrowedContentSource::from_call(func.ty(self.body, tcx), tcx)
{
return source;
}
// If we didn't find an overloaded deref or index, then assume it's a
// built in deref and check the type of the base.
- let base_ty = Place::ty_from(deref_base.local, deref_base.projection, *self.body, tcx).ty;
+ let base_ty = Place::ty_from(deref_base.local, deref_base.projection, self.body, tcx).ty;
if base_ty.is_unsafe_ptr() {
BorrowedContentSource::DerefRawPointer
} else if base_ty.is_mutable_ptr() {
// Inspect the type of the content behind the
// borrow to provide feedback about why this
// was a move rather than a copy.
- let ty = deref_target_place.ty(*self.body, self.infcx.tcx).ty;
+ let ty = deref_target_place.ty(self.body, self.infcx.tcx).ty;
let upvar_field = self
.prefixes(move_place.as_ref(), PrefixSet::All)
.find_map(|p| self.is_upvar_field_projection(p));
}
};
if let Ok(snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(span) {
- let def_id = match move_place.ty(*self.body, self.infcx.tcx).ty.kind {
+ let def_id = match move_place.ty(self.body, self.infcx.tcx).ty.kind {
ty::Adt(self_def, _) => self_def.did,
ty::Foreign(def_id)
| ty::FnDef(def_id, _)
}
if binds_to.is_empty() {
- let place_ty = move_from.ty(*self.body, self.infcx.tcx).ty;
+ let place_ty = move_from.ty(self.body, self.infcx.tcx).ty;
let place_desc = match self.describe_place(move_from.as_ref()) {
Some(desc) => format!("`{}`", desc),
None => "value".to_string(),
// No binding. Nothing to suggest.
GroupedMoveError::OtherIllegalMove { ref original_path, use_spans, .. } => {
let span = use_spans.var_or_use();
- let place_ty = original_path.ty(*self.body, self.infcx.tcx).ty;
+ let place_ty = original_path.ty(self.body, self.infcx.tcx).ty;
let place_desc = match self.describe_place(original_path.as_ref()) {
Some(desc) => format!("`{}`", desc),
None => "value".to_string(),
projection: [proj_base @ .., ProjectionElem::Field(upvar_index, _)],
} => {
debug_assert!(is_closure_or_generator(
- Place::ty_from(local, proj_base, *self.body, self.infcx.tcx).ty
+ Place::ty_from(local, proj_base, self.body, self.infcx.tcx).ty
));
item_msg = format!("`{}`", access_place_desc.unwrap());
Place::ty_from(
the_place_err.local,
the_place_err.projection,
- *self.body,
+ self.body,
self.infcx.tcx
)
.ty
if let Some((span, message)) = annotate_struct_field(
self.infcx.tcx,
- Place::ty_from(local, proj_base, *self.body, self.infcx.tcx).ty,
+ Place::ty_from(local, proj_base, self.body, self.infcx.tcx).ty,
field,
) {
err.span_suggestion(
projection: [proj_base @ .., ProjectionElem::Field(upvar_index, _)],
} => {
debug_assert!(is_closure_or_generator(
- Place::ty_from(local, proj_base, *self.body, self.infcx.tcx).ty
+ Place::ty_from(local, proj_base, self.body, self.infcx.tcx).ty
));
err.span_label(span, format!("cannot {ACT}", ACT = act));
let tcx = self.infcx.tcx;
// Compute the type with accurate region information.
- let drop_place_ty = drop_place.ty(*self.body, self.infcx.tcx);
+ let drop_place_ty = drop_place.ty(self.body, self.infcx.tcx);
// Erase the regions.
let drop_place_ty = self.infcx.tcx.erase_regions(&drop_place_ty).ty;
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
fn body(&self) -> &'cx Body<'tcx> {
- *self.body
+ self.body
}
/// Checks an access to the given place to see if it is allowed. Examines the set of borrows
// derefs, except we stop at the deref of a shared
// reference.
- let ty = Place::ty_from(cursor.local, proj_base, *self.body, self.tcx).ty;
+ let ty = Place::ty_from(cursor.local, proj_base, self.body, self.tcx).ty;
match ty.kind {
ty::RawPtr(_) | ty::Ref(_ /*rgn*/, _ /*ty*/, hir::Mutability::Not) => {
// don't continue traversing over derefs of raw pointers or shared
) -> R {
let mut checker = TypeChecker::new(
infcx,
- *body,
+ body,
mir_def_id,
param_env,
region_bound_pairs,
universal_region_relations,
);
let errors_reported = {
- let mut verifier = TypeVerifier::new(&mut checker, *body, promoted);
+ let mut verifier = TypeVerifier::new(&mut checker, body, promoted);
verifier.visit_body(&body);
verifier.errors_reported
};
};
if !self.errors_reported {
- let promoted_body = self.promoted[promoted];
+ let promoted_body = &self.promoted[promoted];
self.sanitize_promoted(promoted_body, location);
let promoted_ty = promoted_body.return_ty();
- check_err(self, &promoted_body, ty, promoted_ty);
+ check_err(self, promoted_body, ty, promoted_ty);
}
} else {
if let Err(terr) = self.cx.fully_perform_op(
// checker on the promoted MIR, then transfer the constraints back to
// the main MIR, changing the locations to the provided location.
- let parent_body = mem::replace(&mut self.body, *promoted_body);
+ let parent_body = mem::replace(&mut self.body, promoted_body);
// Use new sets of constraints and closure bounds so that we can
// modify their locations.
_ => ConstraintCategory::Assignment,
};
- let place_ty = place.ty(*body, tcx).ty;
+ let place_ty = place.ty(body, tcx).ty;
let place_ty = self.normalize(place_ty, location);
- let rv_ty = rv.ty(*body, tcx);
+ let rv_ty = rv.ty(body, tcx);
let rv_ty = self.normalize(rv_ty, location);
if let Err(terr) =
self.sub_types_or_anon(rv_ty, place_ty, location.to_locations(), category)
}
}
StatementKind::SetDiscriminant { ref place, variant_index } => {
- let place_type = place.ty(*body, tcx).ty;
+ let place_type = place.ty(body, tcx).ty;
let adt = match place_type.kind {
ty::Adt(adt, _) if adt.is_enum() => adt,
_ => {
};
}
StatementKind::AscribeUserType(box (ref place, ref projection), variance) => {
- let place_ty = place.ty(*body, tcx).ty;
+ let place_ty = place.ty(body, tcx).ty;
if let Err(terr) = self.relate_type_and_user_type(
place_ty,
variance,
// While this is located in `nll::typeck` this error is not an NLL error, it's
// a required check to make sure that repeated elements implement `Copy`.
let span = body.source_info(location).span;
- let ty = operand.ty(*body, tcx);
+ let ty = operand.ty(body, tcx);
if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty, span) {
// To determine if `const_in_array_repeat_expressions` feature gate should
// be mentioned, need to check if the rvalue is promotable.
Rvalue::Cast(cast_kind, op, ty) => {
match cast_kind {
CastKind::Pointer(PointerCast::ReifyFnPointer) => {
- let fn_sig = op.ty(*body, tcx).fn_sig(tcx);
+ let fn_sig = op.ty(body, tcx).fn_sig(tcx);
// The type that we see in the fcx is like
// `foo::<'a, 'b>`, where `foo` is the path to a
}
CastKind::Pointer(PointerCast::ClosureFnPointer(unsafety)) => {
- let sig = match op.ty(*body, tcx).kind {
+ let sig = match op.ty(body, tcx).kind {
ty::Closure(_, substs) => substs.as_closure().sig(),
_ => bug!(),
};
}
CastKind::Pointer(PointerCast::UnsafeFnPointer) => {
- let fn_sig = op.ty(*body, tcx).fn_sig(tcx);
+ let fn_sig = op.ty(body, tcx).fn_sig(tcx);
// The type that we see in the fcx is like
// `foo::<'a, 'b>`, where `foo` is the path to a
let &ty = ty;
let trait_ref = ty::TraitRef {
def_id: tcx.lang_items().coerce_unsized_trait().unwrap(),
- substs: tcx.mk_substs_trait(op.ty(*body, tcx), &[ty.into()]),
+ substs: tcx.mk_substs_trait(op.ty(body, tcx), &[ty.into()]),
};
self.prove_trait_ref(
}
CastKind::Pointer(PointerCast::MutToConstPointer) => {
- let ty_from = match op.ty(*body, tcx).kind {
+ let ty_from = match op.ty(body, tcx).kind {
ty::RawPtr(ty::TypeAndMut {
ty: ty_from,
mutbl: hir::Mutability::Mut,
}
CastKind::Pointer(PointerCast::ArrayToPointer) => {
- let ty_from = op.ty(*body, tcx);
+ let ty_from = op.ty(body, tcx);
let opt_ty_elem = match ty_from.kind {
ty::RawPtr(ty::TypeAndMut {
}
CastKind::Misc => {
- let ty_from = op.ty(*body, tcx);
+ let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(ty);
match (cast_ty_from, cast_ty_to) {
left,
right,
) => {
- let ty_left = left.ty(*body, tcx);
+ let ty_left = left.ty(body, tcx);
if let ty::RawPtr(_) | ty::FnPtr(_) = ty_left.kind {
- let ty_right = right.ty(*body, tcx);
+ let ty_right = right.ty(body, tcx);
let common_ty = self.infcx.next_ty_var(TypeVariableOrigin {
kind: TypeVariableOriginKind::MiscVariable,
span: body.source_info(location).span,
}
// This is a const fn. Call it.
Ok(Some(match ecx.load_mir(instance.def, None) {
- Ok(body) => *body,
+ Ok(body) => body,
Err(err) => {
if let err_unsup!(NoMirFor(did)) = err.kind {
let path = ecx.tcx.def_path_str(did);
F: FnMut(Local) -> bool,
{
match rvalue {
- Rvalue::NullaryOp(..) => Q::in_any_value_of_ty(cx, rvalue.ty(*cx.body, cx.tcx)),
+ Rvalue::NullaryOp(..) => Q::in_any_value_of_ty(cx, rvalue.ty(cx.body, cx.tcx)),
Rvalue::Discriminant(place) | Rvalue::Len(place) => {
in_place::<Q, _>(cx, in_local, place.as_ref())
Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
// Special-case reborrows to be more like a copy of the reference.
if let &[ref proj_base @ .., ProjectionElem::Deref] = place.projection.as_ref() {
- let base_ty = Place::ty_from(place.local, proj_base, *cx.body, cx.tcx).ty;
+ let base_ty = Place::ty_from(place.local, proj_base, cx.body, cx.tcx).ty;
if let ty::Ref(..) = base_ty.kind {
return in_place::<Q, _>(
cx,
| ProjectionElem::Index(_) => {}
}
- let base_ty = Place::ty_from(place.local, proj_base, *cx.body, cx.tcx);
+ let base_ty = Place::ty_from(place.local, proj_base, cx.body, cx.tcx);
let proj_ty = base_ty.projection_ty(cx.tcx, proj_elem).ty;
if !Q::in_any_value_of_ty(cx, proj_ty) {
return false;
) {
// We cannot reason about another function's internals, so use conservative type-based
// qualification for the result of a function call.
- let return_ty = return_place.ty(*self.item.body, self.item.tcx).ty;
+ let return_ty = return_place.ty(self.item.body, self.item.tcx).ty;
let qualif = Q::in_any_value_of_ty(self.item, return_ty);
if !return_place.is_indirect() {
impl<Q: Qualif> QualifCursor<'a, 'mir, 'tcx, Q> {
pub fn new(q: Q, item: &'a Item<'mir, 'tcx>) -> Self {
let cursor = FlowSensitiveAnalysis::new(q, item)
- .into_engine(item.tcx, &item.body, item.def_id)
+ .into_engine(item.tcx, item.body, item.def_id)
.iterate_to_fixpoint()
- .into_results_cursor(*item.body);
+ .into_results_cursor(item.body);
let mut in_any_value_of_ty = BitSet::new_empty(item.body.local_decls.len());
for (local, decl) in item.body.local_decls.iter_enumerated() {
//
// FIXME(ecstaticmorse): Someday we want to allow custom drop impls. How do we do this
// without breaking stable code?
- let indirectly_mutable = MaybeMutBorrowedLocals::mut_borrows_only(tcx, *body, param_env)
+ let indirectly_mutable = MaybeMutBorrowedLocals::mut_borrows_only(tcx, body, param_env)
.unsound_ignore_borrow_on_drop()
- .into_engine(tcx, *body, def_id)
+ .into_engine(tcx, body, def_id)
.iterate_to_fixpoint()
- .into_results_cursor(*body);
+ .into_results_cursor(body);
let qualifs = Qualifs { needs_drop, has_mut_interior, indirectly_mutable };
// Special-case reborrows to be more like a copy of a reference.
match *rvalue {
Rvalue::Ref(_, kind, place) => {
- if let Some(reborrowed_proj) = place_as_reborrow(self.tcx, *self.body, place) {
+ if let Some(reborrowed_proj) = place_as_reborrow(self.tcx, self.body, place) {
let ctx = match kind {
BorrowKind::Shared => {
PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow)
}
}
Rvalue::AddressOf(mutbl, place) => {
- if let Some(reborrowed_proj) = place_as_reborrow(self.tcx, *self.body, place) {
+ if let Some(reborrowed_proj) = place_as_reborrow(self.tcx, self.body, place) {
let ctx = match mutbl {
Mutability::Not => {
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
Rvalue::Ref(_, kind @ BorrowKind::Mut { .. }, ref place)
| Rvalue::Ref(_, kind @ BorrowKind::Unique, ref place) => {
- let ty = place.ty(*self.body, self.tcx).ty;
+ let ty = place.ty(self.body, self.tcx).ty;
let is_allowed = match ty.kind {
// Inside a `static mut`, `&mut [...]` is allowed.
ty::Array(..) | ty::Slice(_) if self.const_kind() == ConstKind::StaticMut => {
}
Rvalue::Cast(CastKind::Misc, ref operand, cast_ty) => {
- let operand_ty = operand.ty(*self.body, self.tcx);
+ let operand_ty = operand.ty(self.body, self.tcx);
let cast_in = CastTy::from_ty(operand_ty).expect("bad input type for cast");
let cast_out = CastTy::from_ty(cast_ty).expect("bad output type for cast");
}
Rvalue::BinaryOp(op, ref lhs, _) => {
- if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(*self.body, self.tcx).kind {
+ if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(self.body, self.tcx).kind {
assert!(
op == BinOp::Eq
|| op == BinOp::Ne
match elem {
ProjectionElem::Deref => {
- let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
+ let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
if let ty::RawPtr(_) = base_ty.kind {
if proj_base.is_empty() {
if let (local, []) = (place_local, proj_base) {
| ProjectionElem::Subslice { .. }
| ProjectionElem::Field(..)
| ProjectionElem::Index(_) => {
- let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
+ let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
match base_ty.ty_adt_def() {
Some(def) if def.is_union() => {
self.check_op(ops::UnionAccess);
match &terminator.kind {
TerminatorKind::Call { func, .. } => {
- let fn_ty = func.ty(*self.body, self.tcx);
+ let fn_ty = func.ty(self.body, self.tcx);
let (def_id, substs) = match fn_ty.kind {
ty::FnDef(def_id, substs) => (def_id, substs),
// Check to see if the type of this place can ever have a drop impl. If not, this
// `Drop` terminator is frivolous.
let ty_needs_drop =
- dropped_place.ty(*self.body, self.tcx).ty.needs_drop(self.tcx, self.param_env);
+ dropped_place.ty(self.body, self.tcx).ty.needs_drop(self.tcx, self.param_env);
if !ty_needs_drop {
return;
destination.0,
);
- let ty = dest.ty(&**caller_body, self.tcx);
+ let ty = dest.ty(caller_body, self.tcx);
let temp = LocalDecl::new_temp(ty, callsite.location.span);
assert!(args.next().is_none());
let tuple = Place::from(tuple);
- let tuple_tys = if let ty::Tuple(s) = tuple.ty(&**caller_body, tcx).ty.kind {
+ let tuple_tys = if let ty::Tuple(s) = tuple.ty(caller_body, tcx).ty.kind {
s
} else {
bug!("Closure arguments are not passed as a tuple");
// Otherwise, create a temporary for the arg
let arg = Rvalue::Use(arg);
- let ty = arg.ty(&**caller_body, self.tcx);
+ let ty = arg.ty(caller_body, self.tcx);
let arg_tmp = LocalDecl::new_temp(ty, callsite.location.span);
let arg_tmp = caller_body.local_decls.push(arg_tmp);
// FIXME(eddyb) this is probably excessive, with
// the exception of `union` member accesses.
let ty =
- Place::ty_from(place.local, proj_base, *self.body, self.tcx)
+ Place::ty_from(place.local, proj_base, self.body, self.tcx)
.projection_ty(self.tcx, elem)
.ty;
if ty.is_freeze(self.tcx, self.param_env, DUMMY_SP) {
}
if let BorrowKind::Mut { .. } = kind {
- let ty = place.ty(*self.body, self.tcx).ty;
+ let ty = place.ty(self.body, self.tcx).ty;
// In theory, any zero-sized value could be borrowed
// mutably without consequences. However, only &mut []
ProjectionElem::Field(..) => {
if self.const_kind.is_none() {
let base_ty =
- Place::ty_from(place.local, proj_base, *self.body, self.tcx).ty;
+ Place::ty_from(place.local, proj_base, self.body, self.tcx).ty;
if let Some(def) = base_ty.ty_adt_def() {
// No promotion of union field accesses.
if def.is_union() {
fn validate_rvalue(&self, rvalue: &Rvalue<'tcx>) -> Result<(), Unpromotable> {
match *rvalue {
Rvalue::Cast(CastKind::Misc, ref operand, cast_ty) if self.const_kind.is_none() => {
- let operand_ty = operand.ty(*self.body, self.tcx);
+ let operand_ty = operand.ty(self.body, self.tcx);
let cast_in = CastTy::from_ty(operand_ty).expect("bad input type for cast");
let cast_out = CastTy::from_ty(cast_ty).expect("bad output type for cast");
match (cast_in, cast_out) {
}
Rvalue::BinaryOp(op, ref lhs, _) if self.const_kind.is_none() => {
- if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(*self.body, self.tcx).kind {
+ if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(self.body, self.tcx).kind {
assert!(
op == BinOp::Eq
|| op == BinOp::Ne
// Raw reborrows can come from reference to pointer coercions,
// so are allowed.
if let [proj_base @ .., ProjectionElem::Deref] = place.projection.as_ref() {
- let base_ty = Place::ty_from(place.local, proj_base, *self.body, self.tcx).ty;
+ let base_ty = Place::ty_from(place.local, proj_base, self.body, self.tcx).ty;
if let ty::Ref(..) = base_ty.kind {
return self.validate_place(PlaceRef {
local: place.local,
Rvalue::Ref(_, kind, place) => {
if let BorrowKind::Mut { .. } = kind {
- let ty = place.ty(*self.body, self.tcx).ty;
+ let ty = place.ty(self.body, self.tcx).ty;
// In theory, any zero-sized value could be borrowed
// mutably without consequences. However, only &mut []
// Special-case reborrows to be more like a copy of the reference.
let mut place = place.as_ref();
if let [proj_base @ .., ProjectionElem::Deref] = &place.projection {
- let base_ty = Place::ty_from(place.local, proj_base, *self.body, self.tcx).ty;
+ let base_ty = Place::ty_from(place.local, proj_base, self.body, self.tcx).ty;
if let ty::Ref(..) = base_ty.kind {
place = PlaceRef { local: place.local, projection: proj_base };
}
while let [proj_base @ .., elem] = place_projection {
// FIXME(eddyb) this is probably excessive, with
// the exception of `union` member accesses.
- let ty = Place::ty_from(place.local, proj_base, *self.body, self.tcx)
+ let ty = Place::ty_from(place.local, proj_base, self.body, self.tcx)
.projection_ty(self.tcx, elem)
.ty;
if ty.is_freeze(self.tcx, self.param_env, DUMMY_SP) {
callee: &Operand<'tcx>,
args: &[Operand<'tcx>],
) -> Result<(), Unpromotable> {
- let fn_ty = callee.ty(*self.body, self.tcx);
+ let fn_ty = callee.ty(self.body, self.tcx);
if !self.explicit && self.const_kind.is_none() {
if let ty::FnDef(def_id, _) = fn_ty.kind {