about summary refs log tree commit diff
path: root/tests/ui/c-variadic/no-closure.rs
blob: 830ed962a8c4aa10451ff474dbdb54827db6cebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(c_variadic)]
#![crate_type = "lib"]

// Check that `...` in closures is rejected.

const F: extern "C" fn(...) = |_: ...| {};
//~^ ERROR: unexpected `...`
//~| NOTE: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list

fn foo() {
    let f = |...| {};
    //~^ ERROR: unexpected `...`
    //~| NOTE: not a valid pattern
    //~| NOTE: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list

    let f = |_: ...| {};
    //~^ ERROR: unexpected `...`
    //~| NOTE: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
    f(1i64)
}