- Setup the nightly feature in your lib.rs (lib.rs)
- Add a copy of your feature toggle (other_file.rs)
- Setup your Cargo.toml to have docs.rs enable the conditional compilation from the first 2 steps (Cargo.toml)
Note: step #2 is now only necessary in situations in which rustdoc currently cannot tell cfg() applies to an item (for example a public item inside a private module which is itself cfg'd which then is re-exported). See this issue for more info.