about summary refs log tree commit diff
path: root/tests/ui/explicit-tail-calls/callee_is_ref.fixed
blob: 7525e5c5df84bc7c89381ba589b5993dbdba3403 (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
//@ run-rustfix
#![feature(explicit_tail_calls)]
#![expect(incomplete_features)]

fn f() {}

fn g() {
    become (*(&f))() //~ error: tail calls can only be performed with function definitions or pointers
}

fn h() {
    let table = [f as fn()];
    if let Some(fun) = table.get(0) {
        become (*fun)(); //~ error: tail calls can only be performed with function definitions or pointers
    }
}

fn i() {
    become (***Box::new(&mut &f))(); //~ error: tail calls can only be performed with function definitions or pointers
}

fn main() {
    g();
    h();
    i();
}