Yeah, that was my initial attempt to resolve the issue, to clarify, since the generated code contains modules etc I had to disable at the module level instead rather than any struct as in your example (since I can't change the included code) for example:
pub mod foo {
#![cfg(not(doctest))]
///```
/// Wops
///
pub bar() {}
pub mod submodule{}
}
The breakage arises in my code elsewhere that e.g imports the generated modules (running cargo test --doc)
mod caller {
use crate::foo::submodule; // compiler error since submodule doesn't exist because it wasn't included in the doctest.
}