Skip to content

Commit adb5ded

Browse files
committed
add known-bug test for unsound issue 25860
1 parent 80a2ec4 commit adb5ded

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
// known-bug: #25860
3+
4+
// Should fail. The combination of variance and implied bounds for nested
5+
// references allows us to infer a longer lifetime than we can prove.
6+
7+
static UNIT: &'static &'static () = &&();
8+
9+
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
10+
11+
fn bad<'a, T>(x: &'a T) -> &'static T {
12+
let f: fn(_, &'a T) -> &'static T = foo;
13+
f(UNIT, x)
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)