You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to nightly-2025-05-17, rust would not compile doctests as part of cargo test when cross compiling. In this toolchain version, that was fixed so doctests are part of it: rust-lang/cargo#15462. When building the "test_in_svsm" binaries (e.g. make bin/test-kernel.elf), cargo test is invoked to cross compile the unit tests. With the nightly-2025-05-17 toolchain, this therefore tries to build the doctests for the x86_64-unknown-none target. However, these tests fail to compile on that target. This is partly due to them not specifying no_std, but even if that is given there are other errors.
These are a few options for resolving:
Use the environment variable RUSTDOC=true for cargo test, which makes cargo think there are no doctests at all. This basically replicates what the toolchain was doing anyway prior to this version.
Edit the problematic doctests (which may be all of them?) to have per-target ignores to say they shouldn't be cross-compiled.
Set up our unit test runner to work with doctests as well. I don't know why unit tests and doctest are treated differently, but hopefully a lot of the same infrastructure can be shared. I spent a bit of time trying to do this, but it was nontrivial for me. I also found this comment indicating that doctest integration with custom test runners is not supported, so this might just not be possible at the moment.