base => bug!("Expected upvar, found={:?}", base),
};
- let min_cap_list = match root_var_min_capture_list.get_mut(&var_hir_id) {
- None => {
- let mutability = self.determine_capture_mutability(&typeck_results, &place);
- let min_cap_list = vec![ty::CapturedPlace {
- place,
- info: capture_info,
- mutability,
- region: None,
- }];
- root_var_min_capture_list.insert(var_hir_id, min_cap_list);
- continue;
- }
- Some(min_cap_list) => min_cap_list,
+ let Some(min_cap_list) = root_var_min_capture_list.get_mut(&var_hir_id) else {
+ let mutability = self.determine_capture_mutability(&typeck_results, &place);
+ let min_cap_list = vec![ty::CapturedPlace {
+ place,
+ info: capture_info,
+ mutability,
+ region: None,
+ }];
+ root_var_min_capture_list.insert(var_hir_id, min_cap_list);
+ continue;
};
// Go through each entry in the current list of min_captures
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
)
}
- ty::Tuple(..) => {
+ ty::Tuple(fields) => {
// Only Field projections can be applied to a tuple.
assert!(
captured_by_move_projs.iter().all(|projs| matches!(
))
);
- base_path_ty.tuple_fields().enumerate().any(|(i, element_ty)| {
+ fields.iter().enumerate().any(|(i, element_ty)| {
let paths_using_field = captured_by_move_projs
.iter()
.filter_map(|projs| {
// 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),
);
// 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);
}