I get a linker error when building coretest as part of the check step, or more specifically check-crate-std. The source of the problem is the test test_variadic_fnptr in src/coretest/ptr.rs, and the same error can be provoked by this self-contained program:
fn main() {
extern "C" {
fn printf(_: *const u8, ...);
}
let p: unsafe extern "C" fn(*const u8, ...) = printf;
let _q = p.clone();
}
Some notes:
- compiling with optimizations will inline the
clone and subsequently eliminate all the code including the part taking the address of printf, and then it compiles just fine.
- It appears related to being variadic, since
fabs in place of printf worked just fine.
- It doesn't matter whether I take the address of the function or call it.
Meta
Reproduced with a rustup-provided nightly from August 21 and with the current bootstrap compiler (beta-2016-08-17).