Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d14569b

Browse files
committedJul 24, 2023
Simplify a shadowing replacement (that sometimes identity replaces) with mutation
1 parent 1d45658 commit d14569b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎compiler/rustc_hir_typeck/src/upvar.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
264264
self.demand_eqtype(span, closure_kind.to_ty(self.tcx), closure_kind_ty);
265265

266266
// If we have an origin, store it.
267-
if let Some(origin) = origin {
268-
let origin = if enable_precise_capture(span) {
269-
(origin.0, origin.1)
270-
} else {
271-
(origin.0, Place { projections: vec![], ..origin.1 })
272-
};
267+
if let Some(mut origin) = origin {
268+
if !enable_precise_capture(span) {
269+
// Without precise captures, we just capture the base and ignore
270+
// the projections.
271+
origin.1.projections.clear()
272+
}
273273

274274
self.typeck_results
275275
.borrow_mut()

0 commit comments

Comments
 (0)
Please sign in to comment.