summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/static-closures-with-nonstatic-return.rs
blob: b5f0684bae92b007d55ba3dfca2b81377dd12f3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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() {}