#Best way to cross-compile doctests (on stable)

2 messages · Page 1 of 1 (latest)

silk olive
#

Hi! I have a project that targets x86_64-unknown-linux-musl (AWS Lambda). I'm building it in a devcontainer with the toolchain x86_64-unknown-linux-gnu. I've added the following to .cargo/config.toml to have my tests compile using the target:

[build]
target = "x86_64-unknown-linux-musl"

I have some doctests that I want cargo test to run - but they don't:

note: skipping doctests for ... cross-compilation doctests are not yet supported
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile for more information.

So I could use nightly to cross-compile them, but I'd prefer not to. Can I build in my devcontainer with the host as x86_64-unknown-linux-musl? I've tried using rust-toolchain.toml to install the target, but that doesn't change the host, only the target.
Thank you! ferrisGlasses

silk olive
#

I've mostly given up on not using nightly here, here's the commands I'm using to get this to work (albeit on the wrong target).