Failed to compile new crate due to unfound symbol in `core::ffi`

Hello Rustaceans,

Running into a new problem I've never seen before this morning. I'm using Rust and Cargo versions:

➜  day-four git:(master) ✗ rustc --version
rustc 1.30.0-nightly (33b923fd4 2018-08-18)
➜  day-four git:(master) ✗ cargo --version
cargo 1.29.0-nightly (6a7672ef5 2018-08-14)
➜  day-four git:(master) ✗ 

When trying to compile my small project I get:

➜  day-four git:(master) ✗ cargo run
   Compiling libc v0.2.44                                                                                                                                          
error[E0432]: unresolved import `core::ffi::c_void`
    --> /home/isaak/.cargo/registry/src/
1151 |         pub use core::ffi::c_void;
     |                 ^^^^^^^^^^^^^^^^^ no `c_void` in `ffi`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `libc`.

To learn more, run the command again with --verbose.

What's with this? Is this a bug in the nightly compiler or the libc create. How should I work around this?

Switching over to the stable compiler fixes this for now, but I'm still wondering how I can work around this using the nightly compiler. Thanks for reading!

IIRC c_void has recently been unified between libc and std. Try updating your nightly to the latest (rustup update).

Alternatively, if you're using libc only for the C types, use std::os::raw::* instead.

Yes, c_void has been unified by putting it in libcore, which is then used from libstd and libc. Originally, my PR was checking for 0.31.0 for this exact reason (some 0.30.0 nightlies would ship without core::ffi::c_void, some would ship with it). Looks like this was changed to 0.30.0 later on, apparently because all 0.30.0 stable versions will have it.

The easiest fix for this would probably just be to update your nightly compiler, as kornel says. The version check will work for all future stable versions and nightly compilers except 0.30 ones before that first PR merged.