
Printing "no pattern" as `_` isn't ideal, but better than crashing, and HIR pretty-printing already has plenty of imperfections. The added `f2` and `f6` examples are ones that triggered the crash. Note that some of the added examples are printed badly, e.g. `fn(, ...)`. The next commit will fix those. Fixes #139633.
29 lines
709 B
Rust
29 lines
709 B
Rust
//@ pretty-compare-only
|
|
//@ pretty-mode:hir
|
|
//@ pp-exact:hir-fn-variadic.pp
|
|
|
|
#![feature(c_variadic)]
|
|
|
|
extern "C" {
|
|
pub fn foo(x: i32, va1: ...);
|
|
}
|
|
|
|
pub unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize {
|
|
va2.arg::<usize>()
|
|
}
|
|
|
|
fn main() {
|
|
fn g1(_: extern "C" fn(_: u8, va: ...)) {}
|
|
fn g2(_: extern "C" fn(_: u8, ...)) {}
|
|
fn g3(_: extern "C" fn(u8, va: ...)) {}
|
|
fn g4(_: extern "C" fn(u8, ...)) {}
|
|
|
|
fn g5(_: extern "C" fn(va: ...)) {}
|
|
fn g6(_: extern "C" fn(...)) {}
|
|
|
|
_ = { unsafe extern "C" fn f1(_: u8, va: ...) {} };
|
|
_ = { unsafe extern "C" fn f2(_: u8, ...) {} };
|
|
|
|
_ = { unsafe extern "C" fn f5(va: ...) {} };
|
|
_ = { unsafe extern "C" fn f6(...) {} };
|
|
}
|