about summary refs log tree commit diff
path: root/tests/ui/impl-trait/non-defining-uses/recursive-call.rs
blob: ecddf2cec472e5ccdf3f420d5870408231e3dd3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@ check-pass

// Regression test for the non-defining use error in `gll`.

struct Foo;
impl Foo {
    fn recur(&self, b: bool) -> impl Sized + '_ {
        if b {
            let temp = Foo;
            temp.recur(false);
            // desugars to `Foo::recur(&temp);`
        }

        self
    }

    fn in_closure(&self) -> impl Sized + '_ {
        let _ = || {
            let temp = Foo;
            temp.in_closure();
            // desugars to `Foo::in_closure(&temp);`
        };

        self
    }
}
fn main() {}