I have a crate that need to be compiled with nightly because it use internally ( not in the user interface ) a feature that is a nightly-only experimental API ( core::ffi::c_size_t ).
I'm looking for a way to add this requirement in the crate. Users that use the crate, can use the stable core version until a newer version of my crate that need the nightly core. I don't want to force the user to use the nightly when he compile it's crate, but only when mine is compiled.
How can I add this information in my crate correctly to let cargo call the nightly only for my crate that is a dependency of a crate that don't requires to be build with nightly?
You can't. Nightly propagates through dependencies. If your dependency requires nightly to build, your project will, too. The feature your dependency uses could be changed or removed between compiler versions, causing the dependency to break, which is not acceptable for the stable toolchain.
Here is a link to an answer from @shepmaster on SO which describes this much better than I could: