If you can replace
void qsort(void base[.size * .nmemb], size_t nmemb, size_t size,
int (*compar)(const void [.size], const void [.size]))
with extern "C" fn qsort<erase T>(base: *const T, nmemb: usize, compar: fn(*const T, *const T) -> std::ffi::c_int)
such that `qsort` is still single a regular C function, not something that corresponds to many separate C functions, many good things are possible.In particular for C++, being able to do
struct MyVTable<erase T> {
virt_method_0: fn(*const T) -> bool,
virt_method_2: fn(*const T, usize) -> (usize, usize),
};
struct MyType<erase R> {
vtable: *const MyVTable<MyType<R>>,
rest_of_fields: R,
};
Opens a lot of doors. People while whine because it is exposing the C++ ABI in the Rust API, but that's fine. That's what `private` is there to fix.