diff --git a/mavlink-core/src/lib.rs b/mavlink-core/src/lib.rs
index 12d470b6148fd74260f3116e70d4b251ecd3bdff..0d3273c62b7c216987e2740509f2d2c3e304aff2 100644
--- a/mavlink-core/src/lib.rs
+++ b/mavlink-core/src/lib.rs
@@ -19,6 +19,7 @@
 //! feature without also using the `uavionix` and `icarous` features.
 //!
 #![cfg_attr(not(feature = "std"), no_std)]
+#![cfg_attr(any(docsrs, doc), feature(doc_auto_cfg))]
 #![deny(clippy::all)]
 #![warn(clippy::use_self)]
 
diff --git a/mavlink/src/lib.rs b/mavlink/src/lib.rs
index 3690dd954c549f5547c1c2521a83fb967bcd5dad..71790d96d9ec5a94872401990978eaaf33f0fa12 100644
--- a/mavlink/src/lib.rs
+++ b/mavlink/src/lib.rs
@@ -1,4 +1,5 @@
 #![cfg_attr(not(feature = "std"), no_std)]
+#![cfg_attr(any(docsrs, doc), feature(doc_auto_cfg))]
 // include generate definitions
 include!(concat!(env!("OUT_DIR"), "/mod.rs"));