Skip to content

Commit

Permalink
Extend temporary lifetimes if there is a ref in an enum binding
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikomatsakis committed Jan 17, 2014
1 parent 56f4d18 commit 8f16356
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
*
* P& = ref X
* | StructName { ..., P&, ... }
* | VariantName(..., P&, ...)
* | [ ..., P&, ... ]
* | ( ..., P&, ... )
* | ~P&
Expand All @@ -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))
}
Expand Down

0 comments on commit 8f16356

Please sign in to comment.