1use std::assert_matches::assert_matches;
4use std::iter;
5
6use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
7use rustc_hir::def_id::LocalDefId;
8use rustc_middle::hir::place::{Projection as HirProjection, ProjectionKind as HirProjectionKind};
9use rustc_middle::mir::AssertKind::BoundsCheck;
10use rustc_middle::mir::*;
11use rustc_middle::thir::*;
12use rustc_middle::ty::{self, AdtDef, CanonicalUserTypeAnnotation, Ty, Variance};
13use rustc_middle::{bug, span_bug};
14use rustc_span::Span;
15use tracing::{debug, instrument, trace};
16
17use crate::builder::ForGuard::{OutsideGuard, RefWithinGuard};
18use crate::builder::expr::category::Category;
19use crate::builder::{BlockAnd, BlockAndExtension, Builder, Capture, CaptureMap};
20
21#[derive(Copy, Clone, Debug, PartialEq)]
23pub(crate) enum PlaceBase {
24 Local(Local),
26
27 Upvar {
57 var_hir_id: LocalVarId,
59 closure_def_id: LocalDefId,
61 },
62}
63
64#[derive(Clone, Debug, PartialEq)]
71pub(in crate::builder) struct PlaceBuilder<'tcx> {
72 base: PlaceBase,
73 projection: Vec<PlaceElem<'tcx>>,
74}
75
76fn convert_to_hir_projections_and_truncate_for_capture(
83 mir_projections: &[PlaceElem<'_>],
84) -> Vec<HirProjectionKind> {
85 let mut hir_projections = Vec::new();
86 let mut variant = None;
87
88 for mir_projection in mir_projections {
89 let hir_projection = match mir_projection {
90 ProjectionElem::Deref => HirProjectionKind::Deref,
91 ProjectionElem::Field(field, _) => {
92 let variant = variant.unwrap_or(FIRST_VARIANT);
93 HirProjectionKind::Field(*field, variant)
94 }
95 ProjectionElem::Downcast(.., idx) => {
96 variant = Some(*idx);
102 continue;
103 }
104 ProjectionElem::UnwrapUnsafeBinder(_) => HirProjectionKind::UnwrapUnsafeBinder,
105 ProjectionElem::OpaqueCast(_) => continue,
107 ProjectionElem::Index(..)
108 | ProjectionElem::ConstantIndex { .. }
109 | ProjectionElem::Subslice { .. } => {
110 break;
113 }
114 };
115 variant = None;
116 hir_projections.push(hir_projection);
117 }
118
119 hir_projections
120}
121
122fn is_ancestor_or_same_capture(
136 proj_possible_ancestor: &[HirProjectionKind],
137 proj_capture: &[HirProjectionKind],
138) -> bool {
139 if proj_possible_ancestor.len() > proj_capture.len() {
142 return false;
143 }
144
145 iter::zip(proj_possible_ancestor, proj_capture).all(|(a, b)| a == b)
146}
147
148fn find_capture_matching_projections<'a, 'tcx>(
156 upvars: &'a CaptureMap<'tcx>,
157 var_hir_id: LocalVarId,
158 projections: &[PlaceElem<'tcx>],
159) -> Option<(usize, &'a Capture<'tcx>)> {
160 let hir_projections = convert_to_hir_projections_and_truncate_for_capture(projections);
161
162 upvars.get_by_key_enumerated(var_hir_id.0.local_id).find(|(_, capture)| {
163 let possible_ancestor_proj_kinds: Vec<_> =
164 capture.captured_place.place.projections.iter().map(|proj| proj.kind).collect();
165 is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections)
166 })
167}
168
169#[instrument(level = "trace", skip(cx), ret)]
172fn to_upvars_resolved_place_builder<'tcx>(
173 cx: &Builder<'_, 'tcx>,
174 var_hir_id: LocalVarId,
175 closure_def_id: LocalDefId,
176 projection: &[PlaceElem<'tcx>],
177) -> Option<PlaceBuilder<'tcx>> {
178 let Some((capture_index, capture)) =
179 find_capture_matching_projections(&cx.upvars, var_hir_id, projection)
180 else {
181 let closure_span = cx.tcx.def_span(closure_def_id);
182 if !enable_precise_capture(closure_span) {
183 bug!(
184 "No associated capture found for {:?}[{:#?}] even though \
185 capture_disjoint_fields isn't enabled",
186 var_hir_id,
187 projection
188 )
189 } else {
190 debug!("No associated capture found for {:?}[{:#?}]", var_hir_id, projection,);
191 }
192 return None;
193 };
194
195 let capture_info = &cx.upvars[capture_index];
197
198 let mut upvar_resolved_place_builder = PlaceBuilder::from(capture_info.use_place);
199
200 trace!(?capture.captured_place, ?projection);
203 let remaining_projections = strip_prefix(
204 capture.captured_place.place.base_ty,
205 projection,
206 &capture.captured_place.place.projections,
207 );
208 upvar_resolved_place_builder.projection.extend(remaining_projections);
209
210 Some(upvar_resolved_place_builder)
211}
212
213fn strip_prefix<'tcx>(
220 mut base_ty: Ty<'tcx>,
221 projections: &[PlaceElem<'tcx>],
222 prefix_projections: &[HirProjection<'tcx>],
223) -> impl Iterator<Item = PlaceElem<'tcx>> {
224 let mut iter = projections
225 .iter()
226 .copied()
227 .filter(|elem| !matches!(elem, ProjectionElem::OpaqueCast(..)));
229 for projection in prefix_projections {
230 match projection.kind {
231 HirProjectionKind::Deref => {
232 assert_matches!(iter.next(), Some(ProjectionElem::Deref));
233 }
234 HirProjectionKind::Field(..) => {
235 if base_ty.is_enum() {
236 assert_matches!(iter.next(), Some(ProjectionElem::Downcast(..)));
237 }
238 assert_matches!(iter.next(), Some(ProjectionElem::Field(..)));
239 }
240 HirProjectionKind::OpaqueCast => {
241 assert_matches!(iter.next(), Some(ProjectionElem::OpaqueCast(..)));
242 }
243 HirProjectionKind::UnwrapUnsafeBinder => {
244 assert_matches!(iter.next(), Some(ProjectionElem::UnwrapUnsafeBinder(..)));
245 }
246 HirProjectionKind::Index | HirProjectionKind::Subslice => {
247 bug!("unexpected projection kind: {:?}", projection);
248 }
249 }
250 base_ty = projection.ty;
251 }
252 iter
253}
254
255impl<'tcx> PlaceBuilder<'tcx> {
256 pub(in crate::builder) fn to_place(&self, cx: &Builder<'_, 'tcx>) -> Place<'tcx> {
257 self.try_to_place(cx).unwrap_or_else(|| match self.base {
258 PlaceBase::Local(local) => span_bug!(
259 cx.local_decls[local].source_info.span,
260 "could not resolve local: {local:#?} + {:?}",
261 self.projection
262 ),
263 PlaceBase::Upvar { var_hir_id, closure_def_id: _ } => span_bug!(
264 cx.tcx.hir_span(var_hir_id.0),
265 "could not resolve upvar: {var_hir_id:?} + {:?}",
266 self.projection
267 ),
268 })
269 }
270
271 pub(in crate::builder) fn try_to_place(&self, cx: &Builder<'_, 'tcx>) -> Option<Place<'tcx>> {
273 let resolved = self.resolve_upvar(cx);
274 let builder = resolved.as_ref().unwrap_or(self);
275 let PlaceBase::Local(local) = builder.base else { return None };
276 let projection = cx.tcx.mk_place_elems(&builder.projection);
277 Some(Place { local, projection })
278 }
279
280 pub(in crate::builder) fn resolve_upvar(
291 &self,
292 cx: &Builder<'_, 'tcx>,
293 ) -> Option<PlaceBuilder<'tcx>> {
294 let PlaceBase::Upvar { var_hir_id, closure_def_id } = self.base else {
295 return None;
296 };
297 to_upvars_resolved_place_builder(cx, var_hir_id, closure_def_id, &self.projection)
298 }
299
300 pub(crate) fn base(&self) -> PlaceBase {
301 self.base
302 }
303
304 pub(crate) fn projection(&self) -> &[PlaceElem<'tcx>] {
305 &self.projection
306 }
307
308 pub(crate) fn field(self, f: FieldIdx, ty: Ty<'tcx>) -> Self {
309 self.project(PlaceElem::Field(f, ty))
310 }
311
312 pub(crate) fn deref(self) -> Self {
313 self.project(PlaceElem::Deref)
314 }
315
316 pub(crate) fn downcast(self, adt_def: AdtDef<'tcx>, variant_index: VariantIdx) -> Self {
317 self.project(PlaceElem::Downcast(Some(adt_def.variant(variant_index).name), variant_index))
318 }
319
320 fn index(self, index: Local) -> Self {
321 self.project(PlaceElem::Index(index))
322 }
323
324 pub(crate) fn project(mut self, elem: PlaceElem<'tcx>) -> Self {
325 self.projection.push(elem);
326 self
327 }
328
329 pub(crate) fn clone_project(&self, elem: PlaceElem<'tcx>) -> Self {
331 Self {
332 base: self.base,
333 projection: Vec::from_iter(self.projection.iter().copied().chain([elem])),
334 }
335 }
336}
337
338impl<'tcx> From<Local> for PlaceBuilder<'tcx> {
339 fn from(local: Local) -> Self {
340 Self { base: PlaceBase::Local(local), projection: Vec::new() }
341 }
342}
343
344impl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx> {
345 fn from(base: PlaceBase) -> Self {
346 Self { base, projection: Vec::new() }
347 }
348}
349
350impl<'tcx> From<Place<'tcx>> for PlaceBuilder<'tcx> {
351 fn from(p: Place<'tcx>) -> Self {
352 Self { base: PlaceBase::Local(p.local), projection: p.projection.to_vec() }
353 }
354}
355
356impl<'a, 'tcx> Builder<'a, 'tcx> {
357 pub(crate) fn as_place(
370 &mut self,
371 mut block: BasicBlock,
372 expr_id: ExprId,
373 ) -> BlockAnd<Place<'tcx>> {
374 let place_builder = unpack!(block = self.as_place_builder(block, expr_id));
375 block.and(place_builder.to_place(self))
376 }
377
378 pub(crate) fn as_place_builder(
381 &mut self,
382 block: BasicBlock,
383 expr_id: ExprId,
384 ) -> BlockAnd<PlaceBuilder<'tcx>> {
385 self.expr_as_place(block, expr_id, Mutability::Mut, None)
386 }
387
388 pub(crate) fn as_read_only_place(
394 &mut self,
395 mut block: BasicBlock,
396 expr_id: ExprId,
397 ) -> BlockAnd<Place<'tcx>> {
398 let place_builder = unpack!(block = self.as_read_only_place_builder(block, expr_id));
399 block.and(place_builder.to_place(self))
400 }
401
402 fn as_read_only_place_builder(
409 &mut self,
410 block: BasicBlock,
411 expr_id: ExprId,
412 ) -> BlockAnd<PlaceBuilder<'tcx>> {
413 self.expr_as_place(block, expr_id, Mutability::Not, None)
414 }
415
416 fn expr_as_place(
417 &mut self,
418 mut block: BasicBlock,
419 expr_id: ExprId,
420 mutability: Mutability,
421 fake_borrow_temps: Option<&mut Vec<Local>>,
422 ) -> BlockAnd<PlaceBuilder<'tcx>> {
423 let expr = &self.thir[expr_id];
424 debug!("expr_as_place(block={:?}, expr={:?}, mutability={:?})", block, expr, mutability);
425
426 let this = self;
427 let expr_span = expr.span;
428 let source_info = this.source_info(expr_span);
429 match expr.kind {
430 ExprKind::Scope { region_scope, lint_level, value } => {
431 this.in_scope((region_scope, source_info), lint_level, |this| {
432 this.expr_as_place(block, value, mutability, fake_borrow_temps)
433 })
434 }
435 ExprKind::Field { lhs, variant_index, name } => {
436 let lhs_expr = &this.thir[lhs];
437 let mut place_builder =
438 unpack!(block = this.expr_as_place(block, lhs, mutability, fake_borrow_temps,));
439 if let ty::Adt(adt_def, _) = lhs_expr.ty.kind() {
440 if adt_def.is_enum() {
441 place_builder = place_builder.downcast(*adt_def, variant_index);
442 }
443 }
444 block.and(place_builder.field(name, expr.ty))
445 }
446 ExprKind::Deref { arg } => {
447 let place_builder =
448 unpack!(block = this.expr_as_place(block, arg, mutability, fake_borrow_temps,));
449 block.and(place_builder.deref())
450 }
451 ExprKind::Index { lhs, index } => this.lower_index_expression(
452 block,
453 lhs,
454 index,
455 mutability,
456 fake_borrow_temps,
457 expr_span,
458 source_info,
459 ),
460 ExprKind::UpvarRef { closure_def_id, var_hir_id } => {
461 this.lower_captured_upvar(block, closure_def_id.expect_local(), var_hir_id)
462 }
463
464 ExprKind::VarRef { id } => {
465 let place_builder = if this.is_bound_var_in_guard(id) {
466 let index = this.var_local_id(id, RefWithinGuard);
467 PlaceBuilder::from(index).deref()
468 } else {
469 let index = this.var_local_id(id, OutsideGuard);
470 PlaceBuilder::from(index)
471 };
472 block.and(place_builder)
473 }
474
475 ExprKind::PlaceTypeAscription { source, ref user_ty, user_ty_span } => {
476 let place_builder = unpack!(
477 block = this.expr_as_place(block, source, mutability, fake_borrow_temps,)
478 );
479 if let Some(user_ty) = user_ty {
480 let ty_source_info = this.source_info(user_ty_span);
481 let annotation_index =
482 this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
483 span: user_ty_span,
484 user_ty: user_ty.clone(),
485 inferred_ty: expr.ty,
486 });
487
488 let place = place_builder.to_place(this);
489 this.cfg.push(
490 block,
491 Statement::new(
492 ty_source_info,
493 StatementKind::AscribeUserType(
494 Box::new((
495 place,
496 UserTypeProjection { base: annotation_index, projs: vec![] },
497 )),
498 Variance::Invariant,
499 ),
500 ),
501 );
502 }
503 block.and(place_builder)
504 }
505 ExprKind::ValueTypeAscription { source, ref user_ty, user_ty_span } => {
506 let source_expr = &this.thir[source];
507 let temp = unpack!(
508 block = this.as_temp(block, source_expr.temp_lifetime, source, mutability)
509 );
510 if let Some(user_ty) = user_ty {
511 let ty_source_info = this.source_info(user_ty_span);
512 let annotation_index =
513 this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
514 span: user_ty_span,
515 user_ty: user_ty.clone(),
516 inferred_ty: expr.ty,
517 });
518 this.cfg.push(
519 block,
520 Statement::new(
521 ty_source_info,
522 StatementKind::AscribeUserType(
523 Box::new((
524 Place::from(temp),
525 UserTypeProjection { base: annotation_index, projs: vec![] },
526 )),
527 Variance::Invariant,
528 ),
529 ),
530 );
531 }
532 block.and(PlaceBuilder::from(temp))
533 }
534
535 ExprKind::PlaceUnwrapUnsafeBinder { source } => {
536 let place_builder = unpack!(
537 block = this.expr_as_place(block, source, mutability, fake_borrow_temps,)
538 );
539 block.and(place_builder.project(PlaceElem::UnwrapUnsafeBinder(expr.ty)))
540 }
541 ExprKind::ValueUnwrapUnsafeBinder { source } => {
542 let source_expr = &this.thir[source];
543 let temp = unpack!(
544 block = this.as_temp(block, source_expr.temp_lifetime, source, mutability)
545 );
546 block.and(PlaceBuilder::from(temp).project(PlaceElem::UnwrapUnsafeBinder(expr.ty)))
547 }
548
549 ExprKind::Array { .. }
550 | ExprKind::Tuple { .. }
551 | ExprKind::Adt { .. }
552 | ExprKind::Closure { .. }
553 | ExprKind::Unary { .. }
554 | ExprKind::Binary { .. }
555 | ExprKind::LogicalOp { .. }
556 | ExprKind::Box { .. }
557 | ExprKind::Cast { .. }
558 | ExprKind::Use { .. }
559 | ExprKind::NeverToAny { .. }
560 | ExprKind::PointerCoercion { .. }
561 | ExprKind::Repeat { .. }
562 | ExprKind::Borrow { .. }
563 | ExprKind::RawBorrow { .. }
564 | ExprKind::Match { .. }
565 | ExprKind::If { .. }
566 | ExprKind::Loop { .. }
567 | ExprKind::LoopMatch { .. }
568 | ExprKind::Block { .. }
569 | ExprKind::Let { .. }
570 | ExprKind::Assign { .. }
571 | ExprKind::AssignOp { .. }
572 | ExprKind::Break { .. }
573 | ExprKind::Continue { .. }
574 | ExprKind::ConstContinue { .. }
575 | ExprKind::Return { .. }
576 | ExprKind::Become { .. }
577 | ExprKind::Literal { .. }
578 | ExprKind::NamedConst { .. }
579 | ExprKind::NonHirLiteral { .. }
580 | ExprKind::ZstLiteral { .. }
581 | ExprKind::ConstParam { .. }
582 | ExprKind::ConstBlock { .. }
583 | ExprKind::StaticRef { .. }
584 | ExprKind::InlineAsm { .. }
585 | ExprKind::OffsetOf { .. }
586 | ExprKind::Yield { .. }
587 | ExprKind::ThreadLocalRef(_)
588 | ExprKind::Call { .. }
589 | ExprKind::ByUse { .. }
590 | ExprKind::WrapUnsafeBinder { .. } => {
591 debug_assert!(!matches!(Category::of(&expr.kind), Some(Category::Place)));
593 let temp =
594 unpack!(block = this.as_temp(block, expr.temp_lifetime, expr_id, mutability));
595 block.and(PlaceBuilder::from(temp))
596 }
597 }
598 }
599
600 fn lower_captured_upvar(
604 &mut self,
605 block: BasicBlock,
606 closure_def_id: LocalDefId,
607 var_hir_id: LocalVarId,
608 ) -> BlockAnd<PlaceBuilder<'tcx>> {
609 block.and(PlaceBuilder::from(PlaceBase::Upvar { var_hir_id, closure_def_id }))
610 }
611
612 fn lower_index_expression(
621 &mut self,
622 mut block: BasicBlock,
623 base: ExprId,
624 index: ExprId,
625 mutability: Mutability,
626 fake_borrow_temps: Option<&mut Vec<Local>>,
627 expr_span: Span,
628 source_info: SourceInfo,
629 ) -> BlockAnd<PlaceBuilder<'tcx>> {
630 let base_fake_borrow_temps = &mut Vec::new();
631 let is_outermost_index = fake_borrow_temps.is_none();
632 let fake_borrow_temps = fake_borrow_temps.unwrap_or(base_fake_borrow_temps);
633
634 let base_place =
635 unpack!(block = self.expr_as_place(block, base, mutability, Some(fake_borrow_temps),));
636
637 let index_lifetime = self.thir[index].temp_lifetime;
641 let idx = unpack!(block = self.as_temp(block, index_lifetime, index, Mutability::Not));
642
643 block = self.bounds_check(block, &base_place, idx, expr_span, source_info);
644
645 if is_outermost_index {
646 self.read_fake_borrows(block, fake_borrow_temps, source_info)
647 } else {
648 self.add_fake_borrows_of_base(
649 base_place.to_place(self),
650 block,
651 fake_borrow_temps,
652 expr_span,
653 source_info,
654 );
655 }
656
657 block.and(base_place.index(idx))
658 }
659
660 pub(in crate::builder) fn len_of_slice_or_array(
666 &mut self,
667 block: BasicBlock,
668 place: Place<'tcx>,
669 span: Span,
670 source_info: SourceInfo,
671 ) -> Operand<'tcx> {
672 let place_ty = place.ty(&self.local_decls, self.tcx).ty;
673 match place_ty.kind() {
674 ty::Array(_elem_ty, len_const) => {
675 self.cfg.push_fake_read(block, source_info, FakeReadCause::ForIndex, place);
681 let const_ = Const::Ty(self.tcx.types.usize, *len_const);
682 Operand::Constant(Box::new(ConstOperand { span, user_ty: None, const_ }))
683 }
684 ty::Slice(_elem_ty) => {
685 let ptr_or_ref = if let [PlaceElem::Deref] = place.projection[..]
686 && let local_ty = self.local_decls[place.local].ty
687 && local_ty.is_trivially_pure_clone_copy()
688 {
689 Operand::Copy(Place::from(place.local))
695 } else {
696 let ptr_ty = Ty::new_imm_ptr(self.tcx, place_ty);
697 let slice_ptr = self.temp(ptr_ty, span);
698 self.cfg.push_assign(
699 block,
700 source_info,
701 slice_ptr,
702 Rvalue::RawPtr(RawPtrKind::FakeForPtrMetadata, place),
703 );
704 Operand::Move(slice_ptr)
705 };
706
707 let len = self.temp(self.tcx.types.usize, span);
708 self.cfg.push_assign(
709 block,
710 source_info,
711 len,
712 Rvalue::UnaryOp(UnOp::PtrMetadata, ptr_or_ref),
713 );
714
715 Operand::Move(len)
716 }
717 _ => {
718 span_bug!(span, "len called on place of type {place_ty:?}")
719 }
720 }
721 }
722
723 fn bounds_check(
724 &mut self,
725 block: BasicBlock,
726 slice: &PlaceBuilder<'tcx>,
727 index: Local,
728 expr_span: Span,
729 source_info: SourceInfo,
730 ) -> BasicBlock {
731 let slice = slice.to_place(self);
732
733 let len = self.len_of_slice_or_array(block, slice, expr_span, source_info);
735
736 let bool_ty = self.tcx.types.bool;
738 let lt = self.temp(bool_ty, expr_span);
739 self.cfg.push_assign(
740 block,
741 source_info,
742 lt,
743 Rvalue::BinaryOp(
744 BinOp::Lt,
745 Box::new((Operand::Copy(Place::from(index)), len.to_copy())),
746 ),
747 );
748 let msg = BoundsCheck { len, index: Operand::Copy(Place::from(index)) };
749
750 self.assert(block, Operand::Move(lt), true, msg, expr_span)
752 }
753
754 fn add_fake_borrows_of_base(
755 &mut self,
756 base_place: Place<'tcx>,
757 block: BasicBlock,
758 fake_borrow_temps: &mut Vec<Local>,
759 expr_span: Span,
760 source_info: SourceInfo,
761 ) {
762 let tcx = self.tcx;
763
764 let place_ty = base_place.ty(&self.local_decls, tcx);
765 if let ty::Slice(_) = place_ty.ty.kind() {
766 for (base_place, elem) in base_place.iter_projections().rev() {
771 match elem {
772 ProjectionElem::Deref => {
773 let fake_borrow_deref_ty = base_place.ty(&self.local_decls, tcx).ty;
774 let fake_borrow_ty =
775 Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, fake_borrow_deref_ty);
776 let fake_borrow_temp =
777 self.local_decls.push(LocalDecl::new(fake_borrow_ty, expr_span));
778 let projection = tcx.mk_place_elems(base_place.projection);
779 self.cfg.push_assign(
780 block,
781 source_info,
782 fake_borrow_temp.into(),
783 Rvalue::Ref(
784 tcx.lifetimes.re_erased,
785 BorrowKind::Fake(FakeBorrowKind::Shallow),
786 Place { local: base_place.local, projection },
787 ),
788 );
789 fake_borrow_temps.push(fake_borrow_temp);
790 }
791 ProjectionElem::Index(_) => {
792 let index_ty = base_place.ty(&self.local_decls, tcx);
793 match index_ty.ty.kind() {
794 ty::Slice(_) => break,
797 ty::Array(..) => (),
798 _ => bug!("unexpected index base"),
799 }
800 }
801 ProjectionElem::Field(..)
802 | ProjectionElem::Downcast(..)
803 | ProjectionElem::OpaqueCast(..)
804 | ProjectionElem::ConstantIndex { .. }
805 | ProjectionElem::Subslice { .. }
806 | ProjectionElem::UnwrapUnsafeBinder(_) => (),
807 }
808 }
809 }
810 }
811
812 fn read_fake_borrows(
813 &mut self,
814 bb: BasicBlock,
815 fake_borrow_temps: &mut Vec<Local>,
816 source_info: SourceInfo,
817 ) {
818 for temp in fake_borrow_temps {
822 self.cfg.push_fake_read(bb, source_info, FakeReadCause::ForIndex, Place::from(*temp));
823 }
824 }
825}
826
827fn enable_precise_capture(closure_span: Span) -> bool {
829 closure_span.at_least_rust_2021()
830}