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.
This commit is contained in:
Niko Matsakis 2014-01-17 08:10:42 -05:00
parent 56f4d1831a
commit 8f16356e5f

View File

@ -637,6 +637,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
*
* P& = ref X
* | StructName { ..., P&, ... }
* | VariantName(..., P&, ...)
* | [ ..., P&, ... ]
* | ( ..., P&, ... )
* | ~P&
@ -656,6 +657,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
pats3.iter().any(|&p| is_binding_pat(p))
}
ast::PatEnum(_, Some(ref subpats)) |
ast::PatTup(ref subpats) => {
subpats.iter().any(|&p| is_binding_pat(p))
}