Skip to content

Commit 10b8941

Browse files
committed
fix accidental reversal of 'static, and add a test
1 parent aa469a9 commit 10b8941

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/librustc/middle/free_region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl FreeRegionMap {
9393
let result = sub == sup || {
9494
let sub = ty::ReFree(sub);
9595
let sup = ty::ReFree(sup);
96-
self.relation.contains(&sub, &sup) || self.relation.contains(&sup, &ty::ReStatic)
96+
self.relation.contains(&sub, &sup) || self.relation.contains(&ty::ReStatic, &sup)
9797
};
9898
debug!("sub_free_region(sub={:?}, sup={:?}) = {:?}", sub, sup, result);
9999
result
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test that we recognize that if you have
12+
//
13+
// 'a : 'static
14+
//
15+
// then
16+
//
17+
// 'a : 'b
18+
19+
fn test<'a,'b>(x: &'a i32) -> &'b i32
20+
where 'a: 'static
21+
{
22+
x
23+
}
24+
25+
fn main() { }

0 commit comments

Comments
 (0)