Skip to content

Commit 8f16356

Browse files
committed
Extend temporary lifetimes if there is a ref in an enum binding
too. Previously I had omitted this case since function calls don't get the same treatment on the RHS, but it's different on the pattern and is more consistent -- the goal is to identify `let` statements where `ref` bindings create interior pointers.
1 parent 56f4d18 commit 8f16356

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustc/middle/region.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
637637
*
638638
* P& = ref X
639639
* | StructName { ..., P&, ... }
640+
* | VariantName(..., P&, ...)
640641
* | [ ..., P&, ... ]
641642
* | ( ..., P&, ... )
642643
* | ~P&
@@ -656,6 +657,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
656657
pats3.iter().any(|&p| is_binding_pat(p))
657658
}
658659

660+
ast::PatEnum(_, Some(ref subpats)) |
659661
ast::PatTup(ref subpats) => {
660662
subpats.iter().any(|&p| is_binding_pat(p))
661663
}

0 commit comments

Comments
 (0)