and I am running into a problem where the included code is not documented in a way that rust accepts. As a result, I am hitting this error when I compile:
error: missing documentation for a struct field
I can stop the error by removing the deny(missing_docs) attribute, but removing the attribute is not acceptable as a solution. I tried to put an #allow(missing_docs) outer attribute before the include macro but this did not help:
Hi .. Thanks. Probably this is what I want. I guess there are no such thing as an anonymous module? The one issue I see though is that this module container seems to be blocking all attributes such that even if I don't include an allow of missing_docs as an outer attribute, the code still compiles fine:
mod my_bindings {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
Also, if I explicitly declare no deny(missing_docs) within the module block this does not have any effect as I assumed it would.
mod my_bindings {
#![deny(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
This is probably very basic, but how do you apply attributes to modules that are declared in this way? How do I keep the surrounding attributes (except the missing_docs one).
This does not compile due to the included bindings.rs generated with bindgen not being documented for Rust.
If I wrap the include in a mod, then things compile (surprisingly even without using the allow missing_docs attribute)
#![deny(missing_docs)]
mod my_bindings {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
Compiles fine.
If I explicitly deny missing docs within the module it still compiles fine.
#![deny(missing_docs)]
mod my_bindings {
#![deny(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
or
#![deny(missing_docs)]
mod my_bindings {
#[deny(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
both compile fine. No attributes related to missing_docs seem to apply to the included code. I assume then that no other attributes are applying as well, which is not necessarily what I want.
missing_docs indeed only applies to exported items, and wrapping them in a non pub module was making everything private.
Now your ffi items are in the bindings namespace; if this is not desirable (e.g., you want the equivalent of an anonymous module), you can do the following:
#![deny(missing_docs)]
pub use self::bindings::*;
mod bindings {
#![allow(missing_docs)]
include!(...);
}