summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs
blob: c165e7a1d1a536c69c17a548ab1e9dc8d2c17d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// This is a non-regression test for issue #117146, where NLL and `-Zpolonius=next` computed
// different loan scopes when a region flowed into an SCC whose representative was an existential
// region.

// revisions: nll polonius
// [polonius] compile-flags: -Zpolonius=next

fn main() {
    let a = ();
    let b = |_| &a;
    //[nll]~^ ERROR `a` does not live long enough
    //[polonius]~^^ ERROR `a` does not live long enough
    bad(&b);
    //[nll]~^ ERROR implementation of `Fn`
    //[nll]~| ERROR implementation of `FnOnce`
    //[polonius]~^^^ ERROR implementation of `Fn`
    //[polonius]~| ERROR implementation of `FnOnce`
}

fn bad<F: Fn(&()) -> &()>(_: F) {}