From 98f0e87dafcdcc2915a986555eca62b19942d6a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <bkchr@users.noreply.github.com>
Date: Wed, 9 Feb 2022 13:24:42 +0100
Subject: [PATCH] CI: Check that rustdocs can be generated (#972)

---
 cumulus/.gitlab-ci.yml                        | 11 +++++++++++
 cumulus/client/consensus/aura/src/lib.rs      |  4 ++--
 cumulus/client/network/src/lib.rs             |  2 +-
 cumulus/pallets/collator-selection/src/lib.rs |  2 +-
 cumulus/pallets/parachain-system/src/lib.rs   |  3 +--
 cumulus/test/runtime/src/lib.rs               |  2 +-
 cumulus/test/service/src/chain_spec.rs        |  2 +-
 7 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/cumulus/.gitlab-ci.yml b/cumulus/.gitlab-ci.yml
index b010bade3ee..da01099252a 100644
--- a/cumulus/.gitlab-ci.yml
+++ b/cumulus/.gitlab-ci.yml
@@ -131,6 +131,17 @@ cargo-check-benches:
     - time cargo check --all --benches
     - sccache -s
 
+check-rustdoc:
+  stage:                           test
+  <<:                              *docker-env
+  variables:
+    <<:                            *default-vars
+    SKIP_WASM_BUILD:               1
+    RUSTDOCFLAGS:                  "-Dwarnings"
+  script:
+    - time cargo +nightly doc --workspace --all-features --verbose --no-deps
+    - sccache -s
+
 #### stage:                        publish
 
 publish-s3:
diff --git a/cumulus/client/consensus/aura/src/lib.rs b/cumulus/client/consensus/aura/src/lib.rs
index b25f0195218..3a65e6a0fcd 100644
--- a/cumulus/client/consensus/aura/src/lib.rs
+++ b/cumulus/client/consensus/aura/src/lib.rs
@@ -18,7 +18,7 @@
 //!
 //! This extends the Substrate provided AuRa consensus implementation to make it compatible for
 //! parachains. The main entry points for of this consensus algorithm are [`AuraConsensus::build`]
-//! and [`import_queue`].
+//! and [`fn@import_queue`].
 //!
 //! For more information about AuRa, the Substrate crate should be checked.
 
@@ -216,7 +216,7 @@ where
 	}
 }
 
-/// Parameters of [`AuraConsensus:build`].
+/// Parameters of [`AuraConsensus::build`].
 pub struct BuildAuraConsensusParams<PF, BI, CIDP, Client, BS, SO> {
 	pub proposer_factory: PF,
 	pub create_inherent_data_providers: CIDP,
diff --git a/cumulus/client/network/src/lib.rs b/cumulus/client/network/src/lib.rs
index 2010803d384..78c9a5011bb 100644
--- a/cumulus/client/network/src/lib.rs
+++ b/cumulus/client/network/src/lib.rs
@@ -211,7 +211,7 @@ impl TryFrom<&'_ CollationSecondedSignal> for BlockAnnounceData {
 /// will call this validator and provides the extra data that was attached to the announcement.
 /// We call this extra data `justification`.
 /// It is expected that the attached data is a SCALE encoded [`BlockAnnounceData`]. The
-/// statement is checked to be a [`CompactStatement::Candidate`] and that it is signed by an active
+/// statement is checked to be a [`CompactStatement::Seconded`] and that it is signed by an active
 /// parachain validator.
 ///
 /// If no justification was provided we check if the block announcement is at the tip of the known
diff --git a/cumulus/pallets/collator-selection/src/lib.rs b/cumulus/pallets/collator-selection/src/lib.rs
index f4eade05937..53a619442ba 100644
--- a/cumulus/pallets/collator-selection/src/lib.rs
+++ b/cumulus/pallets/collator-selection/src/lib.rs
@@ -31,7 +31,7 @@
 //!
 //! ## Implementation
 //!
-//! The final [`Collators`] are aggregated from two individual lists:
+//! The final `Collators` are aggregated from two individual lists:
 //!
 //! 1. [`Invulnerables`]: a set of collators appointed by governance. These accounts will always be
 //!    collators.
diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs
index 7c261e8583c..813ef073c7e 100644
--- a/cumulus/pallets/parachain-system/src/lib.rs
+++ b/cumulus/pallets/parachain-system/src/lib.rs
@@ -45,7 +45,6 @@ use frame_support::{
 };
 use frame_system::{ensure_none, ensure_root};
 use polkadot_parachain::primitives::RelayChainBlockNumber;
-use relay_state_snapshot::MessagingStateSnapshot;
 use sp_runtime::{
 	traits::{Block as BlockT, BlockNumberProvider, Hash},
 	transaction_validity::{
@@ -85,7 +84,7 @@ mod tests;
 /// # fn main() {}
 /// ```
 pub use cumulus_pallet_parachain_system_proc_macro::register_validate_block;
-pub use relay_state_snapshot::RelayChainStateProof;
+pub use relay_state_snapshot::{MessagingStateSnapshot, RelayChainStateProof};
 
 pub use pallet::*;
 
diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs
index 56858071209..4a3814a5c3a 100644
--- a/cumulus/test/runtime/src/lib.rs
+++ b/cumulus/test/runtime/src/lib.rs
@@ -68,7 +68,7 @@ impl_opaque_keys! {
 	pub struct SessionKeys {}
 }
 
-/// Some key that we set in genesis and only read in [`TestRuntimeUpgrade`] to ensure that
+/// Some key that we set in genesis and only read in [`TestOnRuntimeUpgrade`] to ensure that
 /// [`OnRuntimeUpgrade`] works as expected.
 pub const TEST_RUNTIME_UPGRADE_KEY: &[u8] = b"+test_runtime_upgrade_key+";
 
diff --git a/cumulus/test/service/src/chain_spec.rs b/cumulus/test/service/src/chain_spec.rs
index c3004dfa535..e1399e97a36 100644
--- a/cumulus/test/service/src/chain_spec.rs
+++ b/cumulus/test/service/src/chain_spec.rs
@@ -54,7 +54,7 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
 		.public()
 }
 
-/// The extensions for the [`ChainSpec`].
+/// The extensions for the [`ChainSpec`](crate::ChainSpec).
 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
 #[serde(deny_unknown_fields)]
 pub struct Extensions {
-- 
GitLab