Skip to content

Commit 7167c7b

Browse files
committed
---
yaml --- r: 107758 b: refs/heads/dist-snap c: cb5d723 h: refs/heads/master v: v3
1 parent e2c9f93 commit 7167c7b

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 279fe0fa76ea1db3173c2b1d43a65dddf3126332
9+
refs/heads/dist-snap: cb5d7236f14209209e637e475bcefece935a6b56
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/region.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,14 @@ impl RegionMaps {
172172
}
173173

174174
// 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+
176183
let terminating_scopes = self.terminating_scopes.borrow();
177184
while !terminating_scopes.get().contains(&id) {
178185
match self.opt_encl_scope(id) {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,14 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// This test verifies that temporary lifetime is correctly computed
12+
// for static objects in enclosing scopes.
13+
1114
extern mod extra;
1215
use std::cmp::Eq;
1316

1417
fn f<T:Eq>(o: &mut Option<T>) {
1518
assert!(*o == None);
1619
}
1720

18-
fn main() {
21+
pub fn main() {
22+
mod t {
23+
enum E {V=1, A=0}
24+
static C: E = V;
25+
}
26+
1927
f::<int>(&mut None);
20-
//~^ ERROR cannot borrow
2128
}

0 commit comments

Comments
 (0)