How do I exclude a file from being built on OS X?

我的未来我决定 提交于 2019-12-01 19:25:51

Writing #![cfg(target_os = "linux")] (note the exclamation mark) at the top of the file will work for the whole file (as long as it contains a single module), not just for the next block (item). Source: Rust reference.

Edit: if you can move that file into its own crate, you could take advantage of Cargo's platform-specific dependencies.

it looks like that's currently not possible. I filed a feature request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!