Skip to content

Commit fbfb620

Browse files
committed
add known-bug test for unsound issue 84366
1 parent 232d685 commit fbfb620

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
// known-bug: #84366
3+
4+
// Should fail. Associated types of 'static types should be `'static`, but
5+
// argument-free closures can be `'static` and return non-`'static` types.
6+
7+
#[allow(dead_code)]
8+
fn foo<'a>() {
9+
let closure = || -> &'a str { "" };
10+
assert_static(closure);
11+
}
12+
13+
fn assert_static<T: 'static>(_: T) {}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)