ty::ClosureKind::FnOnce => {}
}
- // We won't be building MIR if the closure wasn't local
- let closure_hir_id = tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
- let closure_span = tcx.hir().span(closure_hir_id);
-
let Some((capture_index, capture)) =
find_capture_matching_projections(
typeck_results,
closure_def_id,
&from_builder.projection,
) else {
+ let closure_span = tcx.def_span(closure_def_id);
if !enable_precise_capture(tcx, closure_span) {
bug!(
"No associated capture found for {:?}[{:#?}] even though \
return Err(from_builder);
};
+ // We won't be building MIR if the closure wasn't local
+ let closure_hir_id = tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
let closure_ty = typeck_results.node_type(closure_hir_id);
let substs = match closure_ty.kind() {
// we need to deref it
upvar_resolved_place_builder = match capture.info.capture_kind {
ty::UpvarCapture::ByRef(_) => upvar_resolved_place_builder.deref(),
- ty::UpvarCapture::ByValue(_) => upvar_resolved_place_builder,
+ ty::UpvarCapture::ByValue => upvar_resolved_place_builder,
};
let next_projection = capture.place.projections.len();
}
crate fn downcast(self, adt_def: &'tcx AdtDef, variant_index: VariantIdx) -> Self {
- self.project(PlaceElem::Downcast(
- Some(adt_def.variants[variant_index].ident.name),
- variant_index,
- ))
+ self.project(PlaceElem::Downcast(Some(adt_def.variants[variant_index].name), variant_index))
}
fn index(self, index: Local) -> Self {
| ExprKind::ConstBlock { .. }
| ExprKind::StaticRef { .. }
| ExprKind::InlineAsm { .. }
- | ExprKind::LlvmInlineAsm { .. }
| ExprKind::Yield { .. }
| ExprKind::ThreadLocalRef(_)
| ExprKind::Call { .. } => {