Files
rust/tests/ui/c-variadic/no-closure.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
646 B
Rust
Raw Permalink Normal View History

2025-09-03 16:56:13 +02:00
#![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
2025-09-03 16:56:13 +02:00
fn foo() {
let f = |...| {};
2025-09-15 03:10:27 -07:00
//~^ ERROR: unexpected `...`
//~| NOTE: not a valid pattern
//~| NOTE: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
2025-09-03 16:56:13 +02:00
let f = |_: ...| {};
//~^ ERROR: unexpected `...`
//~| NOTE: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
2025-09-03 16:56:13 +02:00
f(1i64)
}