// Returns a list of `Ty`s for each upvar.
fn final_upvar_tys(&self, closure_id: DefId) -> Vec<Ty<'tcx>> {
+ // Presently an unboxed closure type cannot "escape" out of a
+ // function, so we will only encounter ones that originated in the
+ // local crate or were inlined into it along with some function.
+ // This may change if abstract return types of some sort are
+ // implemented.
self.typeck_results
.borrow()
.closure_min_captures_flattened(closure_id)
self.tcx,
ty,
max_capture_info.capture_kind,
- Some(&ty::ReErased),
+ Some(self.tcx.lifetimes.re_erased),
)
}
};
self.tcx,
capture.place.ty(),
capture.info.capture_kind,
- Some(&ty::ReErased),
+ Some(self.tcx.lifetimes.re_erased),
);
// Checks if a capture implements any of the auto traits
// If the data will be moved out of this place, then the place will be truncated
// at the first Deref in `adjust_upvar_borrow_kind_for_consume` and then moved into
// the closure.
- hir::CaptureBy::Value if !place.deref_tys().any(ty::TyS::is_ref) => {
+ hir::CaptureBy::Value if !place.deref_tys().any(Ty::is_ref) => {
ty::UpvarCapture::ByValue
}
hir::CaptureBy::Value | hir::CaptureBy::Ref => ty::UpvarCapture::ByRef(ty::ImmBorrow),
match p.kind {
ProjectionKind::Field(..) => match ty.kind() {
ty::Adt(def, _) if def.repr.packed() => {
- match tcx.layout_of(param_env.and(p.ty)) {
+ // We erase regions here because they cannot be hashed
+ match tcx.layout_of(param_env.and(tcx.erase_regions(p.ty))) {
Ok(layout) if layout.align.abi.bytes() == 1 => {
// if the alignment is 1, the type can't be further
// disaligned.
);
// Raw pointers don't inherit mutability
- if place_with_id.place.deref_tys().any(ty::TyS::is_unsafe_ptr) {
+ if place_with_id.place.deref_tys().any(Ty::is_unsafe_ptr) {
capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::ImmBorrow);
}