We couldn't get Bitcode and Rust to play nice, until we did
At Ditto we build most of our software using Rust. It helps us make DittoKit fast and reliable, and lets us reuse our code on every platform that we support including Apple iOS.
While the Rust project has excellent support for creating iOS libraries, Apple also encourages developers to provide Bitcode. This technology allows Apple to further optimize an app after the developer built it. Some of our customers have Bitcode enabled so DittoKit needs to support it too. Unfortunately, Rust's version of Bitcode often doesn't work in Xcode.
Using the standard Rust distribution, you may see an error like this when you try to build your app for a physical iOS device—it suggests that the Bitcode is missing, even though it isn't. The real problem is that Rust and Xcode are using different versions of LLVM so the Bitcode is incompatible. The Rust project is discussing how to manage this problem moving forward.
For now, we can build a custom version of Rust that has exactly the right version of LLVM. At Ditto we have produced scripts that will automatically build a compatible Rust toolchain for use with physical iOS devices. We use this to ship Rust code for iOS—and you can use it too! Both our scripts and binary releases of the toolchain are freely available on GitHub. Bug reports and contributions are very welcome. We're excited to see Rust used more to build great mobile apps!Rust Bitcode Github Repository