add known-bug test for unsound issue 25860
This commit is contained in:
parent
80a2ec49a4
commit
adb5ded7a7
1 changed files with 16 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
|||
// check-pass
|
||||
// known-bug: #25860
|
||||
|
||||
// Should fail. The combination of variance and implied bounds for nested
|
||||
// references allows us to infer a longer lifetime than we can prove.
|
||||
|
||||
static UNIT: &'static &'static () = &&();
|
||||
|
||||
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
|
||||
|
||||
fn bad<'a, T>(x: &'a T) -> &'static T {
|
||||
let f: fn(_, &'a T) -> &'static T = foo;
|
||||
f(UNIT, x)
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Reference in a new issue