Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken intra-doc links + add CI stage to test example docs #606

Merged
merged 19 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ examples-contract-build:
popd;
done

examples-docs:
stage: examples
<<: *docker-env
variables:
RUSTDOCFLAGS: -Dwarnings
script:
# `--document-private-items` needs to be in here because currently our contract macro
# puts the contract functions in a private module.
# Once https://github.com/paritytech/ink/issues/336 has been implemented we can get rid
# of this flag.
- for example in examples/*/; do
cargo doc --manifest-path ${example}/Cargo.toml --document-private-items --verbose --no-deps;
cmichi marked this conversation as resolved.
Show resolved Hide resolved
done

#### stage: publish

publish-docs:
Expand Down
5 changes: 4 additions & 1 deletion crates/env/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ use crate::{
};
use ink_primitives::Key;

#[cfg(doc)]
use crate as ink_env;

/// The flags to indicate further information about the end of a contract execution.
pub struct ReturnFlags {
value: u32,
Expand Down Expand Up @@ -165,7 +168,7 @@ pub trait TypedEnvBackend: EnvBackend {
///
/// # Note
///
/// For more details visit: [`ink_env::gas_price`]
/// For more details visit: [`ink_env::weight_to_fee`]
fn weight_to_fee<T: Environment>(&mut self, gas: u64) -> Result<T::Balance>;

/// Returns the amount of gas left for the contract execution.
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/engine/off_chain/db/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct Block {
/// # Note
///
/// - Can optionally be set for more control via
/// [`crate::set_block_randomization_hash`].
/// [`crate::test::set_block_entropy`].
entropy: OffHash,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/lang/codegen/src/generator/cross_calling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl CrossCalling<'_> {
}
}

/// Builds up the [`ink_env::call::ArgumentList`] type structure for the given types.
/// Builds up the `ink_env::call::utils::ArgumentList` type structure for the given types.
cmichi marked this conversation as resolved.
Show resolved Hide resolved
fn generate_arg_list<'a, Args>(args: Args) -> TokenStream2
where
Args: IntoIterator<Item = &'a syn::Type>,
Expand Down
3 changes: 3 additions & 0 deletions crates/storage/src/collections/bitstash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ use crate::collections::{
Vec as StorageVec,
};

#[cfg(doc)]
use crate::collections::Bitvec;

/// The index type used in the storage bit stash.
type Index = u32;

Expand Down
3 changes: 3 additions & 0 deletions crates/storage/src/collections/smallvec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ use crate::{
traits::PackedLayout,
};

#[cfg(doc)]
use crate::traits::SpreadLayout;

/// The used index type.
type Index = u32;

Expand Down
3 changes: 3 additions & 0 deletions crates/storage/src/collections/stash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ use crate::{
};
use ink_primitives::Key;

#[cfg(doc)]
use crate::traits::SpreadLayout;

cmichi marked this conversation as resolved.
Show resolved Hide resolved
/// An index into the stash.
type Index = u32;

Expand Down
3 changes: 3 additions & 0 deletions crates/storage/src/collections/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ use crate::{
traits::PackedLayout,
};

#[cfg(doc)]
use crate::traits::SpreadLayout;

/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
///
/// # Note
Expand Down
1 change: 1 addition & 0 deletions crates/storage/src/lazy/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#[cfg(doc)]
use crate::lazy::{
LazyArray,
LazyCell,
LazyIndexMap,
};
use crate::traits::{
Expand Down
3 changes: 3 additions & 0 deletions crates/storage/src/lazy/lazy_hmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ use ink_prelude::{
};
use ink_primitives::Key;

#[cfg(doc)]
use crate::lazy::LazyIndexMap;

cmichi marked this conversation as resolved.
Show resolved Hide resolved
/// The map for the contract storage entries.
///
/// # Note
Expand Down
2 changes: 1 addition & 1 deletion examples/dns/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod dns {
}

/// Domain name service contract inspired by ChainX's [blog post]
/// (https://medium.com/@chainx_org/secure-and-decentralized-polkadot-domain-name-system-e06c35c2a48d).
/// (<https://medium.com/@chainx_org/secure-and-decentralized-polkadot-domain-name-system-e06c35c2a48d>).
cmichi marked this conversation as resolved.
Show resolved Hide resolved
///
/// # Note
///
Expand Down