add known-bug test for unsound issue 84366
This commit is contained in:
parent
232d685e61
commit
fbfb620de8
15
tests/ui/closures/static-closures-with-nonstatic-return.rs
Normal file
15
tests/ui/closures/static-closures-with-nonstatic-return.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// check-pass
|
||||||
|
// known-bug: #84366
|
||||||
|
|
||||||
|
// Should fail. Associated types of 'static types should be `'static`, but
|
||||||
|
// argument-free closures can be `'static` and return non-`'static` types.
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn foo<'a>() {
|
||||||
|
let closure = || -> &'a str { "" };
|
||||||
|
assert_static(closure);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn assert_static<T: 'static>(_: T) {}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user