File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/dist-snap: 279fe0fa76ea1db3173c2b1d43a65dddf3126332
9
+ refs/heads/dist-snap: cb5d7236f14209209e637e475bcefece935a6b56
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
12
12
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
Original file line number Diff line number Diff line change @@ -172,7 +172,14 @@ impl RegionMaps {
172
172
}
173
173
174
174
// else, locate the innermost terminating scope
175
- let mut id = self . encl_scope ( expr_id) ;
175
+ // if there's one. Static items, for instance, won't
176
+ // have an enclusing scope, hence no scope will be
177
+ // returned.
178
+ let mut id = match self . opt_encl_scope ( expr_id) {
179
+ Some ( i) => i,
180
+ None => { return None ; }
181
+ } ;
182
+
176
183
let terminating_scopes = self . terminating_scopes . borrow ( ) ;
177
184
while !terminating_scopes. get ( ) . contains ( & id) {
178
185
match self . opt_encl_scope ( id) {
Original file line number Diff line number Diff line change 1
- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
2
// file at the top-level directory of this distribution and at
3
3
// http://rust-lang.org/COPYRIGHT.
4
4
//
8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ // This test verifies that temporary lifetime is correctly computed
12
+ // for static objects in enclosing scopes.
13
+
11
14
extern mod extra;
12
15
use std:: cmp:: Eq ;
13
16
14
17
fn f < T : Eq > ( o : & mut Option < T > ) {
15
18
assert ! ( * o == None ) ;
16
19
}
17
20
18
- fn main ( ) {
21
+ pub fn main ( ) {
22
+ mod t {
23
+ enum E { V =1 , A =0 }
24
+ static C : E = V ;
25
+ }
26
+
19
27
f :: < int > ( & mut None ) ;
20
- //~^ ERROR cannot borrow
21
28
}
You can’t perform that action at this time.
0 commit comments