Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Disallow broken intra-doc Cargo links (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
neysofu authored Aug 23, 2021
1 parent e4068d0 commit b663daf
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ jobs:
toolchain: nightly
command: test
args: --all --features=default-cranelift,default-memory --no-default-features -- --nocapture
components: rustdoc
- name: Run `cargo doc`
uses: actions-rs/cargo@v1
with:
command: doc
args: --all
wasm_codec:
runs-on: macos-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions crates/abi/decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![allow(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

mod calldata;
mod cursor;
Expand Down
1 change: 1 addition & 0 deletions crates/abi/encoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

mod traits;
mod types;
Expand Down
1 change: 1 addition & 0 deletions crates/abi/layout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

#[allow(clippy::unusual_byte_groupings)]
#[doc(hidden)]
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! ABI.

#![allow(unused)]
#![deny(rustdoc::broken_intra_doc_links)]

mod subcmd_craft_deploy;
mod subcmd_tx;
Expand Down
1 change: 1 addition & 0 deletions crates/codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(vec_into_raw_parts)]

mod codec_impls;
Expand Down
5 changes: 3 additions & 2 deletions crates/gas/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! This crate is responsible for doing gas validation & estimation for transactions.

#![allow(missing_docs)]
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]

//! This crate is responsible for doing gas validation & estimation for transactions.
#![deny(rustdoc::broken_intra_doc_links)]

mod call_graph;
mod cfg;
Expand Down
3 changes: 2 additions & 1 deletion crates/hash/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! A [`Hasher`] trait for wide-digest algorithms and its [`DefaultHasher`]
//! A [`Hasher`] trait for wide-digest algorithms and [`Blake3Hasher`]
//! implementation.

#![deny(missing_docs)]
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

/// A low-level trait for defining a hasher.
pub trait Hasher: Default {
Expand Down
1 change: 1 addition & 0 deletions crates/kv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

//! The `svm-kv` crate is responsible on providing different implementations for the `KVStore` trait.

Expand Down
1 change: 1 addition & 0 deletions crates/layout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

//! This crate is responsible of representing an `Account`'s storage variables `Layout`.

Expand Down
1 change: 1 addition & 0 deletions crates/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

use parity_wasm::elements::Instruction;

Expand Down
1 change: 1 addition & 0 deletions crates/query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

pub mod query;
pub mod render;
Expand Down
9 changes: 6 additions & 3 deletions crates/runtime-ffi/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,17 @@ pub unsafe extern "C" fn svm_runtime_destroy(runtime: *mut c_void) {

/// Allocates `svm_byte_array` to be used later for passing a binary [`Envelope`].
///
/// The number of allocated bytes is a fixed, and it equals to [`svm_codec::envelope::byte_size()`](svm_codec::envelope::byte_size).
/// The number of allocated bytes is equal to [`Envelope`]'s
/// [`Codec::fixed_size()`].
#[must_use]
#[no_mangle]
pub extern "C" fn svm_envelope_alloc() -> svm_byte_array {
let size = Envelope::fixed_size().unwrap();
svm_byte_array::with_capacity(size, ENVELOPE_TYPE)
}

/// Allocates `svm_byte_array` of `size` bytes, meant to be used for passing a binary [`Message`].
/// Allocates `svm_byte_array` of `size` bytes, meant to be used for passing a
/// binary message.
#[must_use]
#[no_mangle]
pub extern "C" fn svm_message_alloc(size: u32) -> svm_byte_array {
Expand All @@ -121,7 +123,8 @@ pub extern "C" fn svm_message_alloc(size: u32) -> svm_byte_array {

/// Allocates `svm_byte_array` to be used later for passing a binary [`Context`].
///
/// The number of allocated bytes is a fixed, and it equals to [`svm_codec::context::byte_size()`](svm_codec::context::byte_size).
/// The number of allocated bytes is equal to [`Context`]'s
/// [`Codec::fixed_size()`].
#[must_use]
#[no_mangle]
pub extern "C" fn svm_context_alloc() -> svm_byte_array {
Expand Down
1 change: 1 addition & 0 deletions crates/runtime-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(vec_into_raw_parts)]
#![feature(ptr_as_uninit)]

Expand Down
1 change: 1 addition & 0 deletions crates/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![deny(unused)]
#![warn(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(vec_into_raw_parts)]

mod env;
Expand Down
1 change: 1 addition & 0 deletions crates/sdk/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

extern crate alloc;

Expand Down
8 changes: 4 additions & 4 deletions crates/sdk/host/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#![no_std]
#![feature(maybe_uninit_uninit_array)]
#![feature(once_cell)]

//! This crate implements SDK for SVM.
//! Using this crate when writing SVM Templates in Rust isn't mandatory but should be very useful.
//!
//! The crate is compiled with `![no_std]` (no Rust standard-library) annotation in order to reduce the compiled WASM size.

#![no_std]
#![allow(missing_docs)]
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(maybe_uninit_uninit_array)]
#![feature(once_cell)]

pub mod traits;

Expand Down
1 change: 1 addition & 0 deletions crates/sdk/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

mod function;
mod json;
Expand Down
3 changes: 2 additions & 1 deletion crates/sdk/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
//! By introducing this crate we have full control of the emitted Wasm and we can cherry-pick only features that are relevant for us.

#![no_std]
#![feature(core_intrinsics)]
#![deny(missing_docs)]
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(core_intrinsics)]

mod log;
pub use log::log;
Expand Down
3 changes: 2 additions & 1 deletion crates/sdk/std/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use core::cmp::{Eq, PartialEq};

use crate::Result;

/// Fixed-Gas replacement for [`std::option::Option`].
/// Fixed-Gas replacement for
/// [`std::option::Option`](https://doc.rust-lang.org/std/option/enum.Option.html).
pub enum Option<T> {
/// Represents Missing `value`
None,
Expand Down
3 changes: 2 additions & 1 deletion crates/sdk/std/src/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pub use traits::ToString;

use crate::Vec;

/// Fixed-Gas replacement for [`std::string::String`].
/// Fixed-Gas replacement for
/// [`std::string::String`](https://doc.rust-lang.org/std/string/struct.String.html).
pub enum String {
/// A String longer than 8 bytes (data is stored on the `Heap`).
Long(Vec<u8>),
Expand Down
3 changes: 2 additions & 1 deletion crates/sdk/std/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use core::ops::{Deref, DerefMut};

use crate::ensure;

/// Fixed-Gas replacement for [`std::vec::Vec`].
/// Fixed-Gas replacement for
/// [`std::vec::Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html).
pub struct Vec<T> {
len: usize,
cap: usize,
Expand Down
1 change: 1 addition & 0 deletions crates/sdk/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![allow(unused)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

mod ext;
mod mock;
Expand Down
1 change: 1 addition & 0 deletions crates/state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

mod error;

Expand Down
1 change: 1 addition & 0 deletions crates/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]

//! This crate is responsible on managing an `Account's storage.
//!
Expand Down
1 change: 1 addition & 0 deletions crates/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![deny(unused)]
#![deny(dead_code)]
#![deny(unreachable_code)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(const_type_id)]
#![feature(const_type_name)]
#![feature(vec_into_raw_parts)]
Expand Down

0 comments on commit b663daf

Please sign in to comment.