Skip to content

Commit 5f52f96

Browse files
authored
docs: Add [package.metadata.docs.rs] and doc_auto_cfg (#350)
* docs: Add [package.metadata.docs.rs] and doc_auto_cfg #### Problem A few packages aren't configured properly for the docs.rs build to handle features. #### Summary of changes Add `[package.metadata.docs.rs]` to Cargo.toml files that don't have it, and `#![cfg_attr(docsrs, feature(doc_auto_cfg))]` to lib.rs files that don't have it either. Also, add a CI step to make sure that all Cargo.toml and lib.rs files have the proper annotations. * Fix shellcheck error * Improve regex
1 parent b6d7418 commit 5f52f96

File tree

72 files changed

+133
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+133
-1
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: Run ShellCheck
3737
run: ./scripts/check-shell.sh
3838

39+
- name: Check doc features
40+
run: ./scripts/check-doc-features.sh
41+
3942
check-crates:
4043
name: Check crate ownership
4144
runs-on: ubuntu-latest

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ check-cfg = [
118118
'cfg(feature, values("frozen-abi", "no-entrypoint"))',
119119
]
120120

121+
[workspace.metadata.docs.rs]
122+
targets = ["x86_64-unknown-linux-gnu"]
123+
all-features = true
124+
rustdoc-args = ["--cfg=docsrs"]
125+
121126
[workspace.metadata.release]
122127
pre-release-commit-message = "Publish {{crate_name}} v{{version}}"
123128
tag-message = "Publish {{crate_name}} v{{version}}"

address/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ homepage = { workspace = true }
1010
license = { workspace = true }
1111
edition = { workspace = true }
1212

13+
[package.metadata.docs.rs]
14+
targets = ["x86_64-unknown-linux-gnu"]
15+
all-features = true
16+
rustdoc-args = ["--cfg=docsrs"]
17+
1318
[features]
1419
atomic = ["dep:solana-atomic-u64"]
1520
borsh = ["dep:borsh", "std"]

atomic-u64/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
12
pub use implementation::AtomicU64;
23

34
#[cfg(target_pointer_width = "64")]

big-mod-exp/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
12
#[repr(C)]
23
pub struct BigModExpParams {
34
pub base: *const u8,

bincode/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Contains a single utility function for deserializing from [bincode].
22
//!
33
//! [bincode]: https://docs.rs/bincode
4+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
45

56
use {bincode::config::Options, solana_instruction_error::InstructionError};
67

bls-signatures/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ homepage = { workspace = true }
1010
license = { workspace = true }
1111
edition = { workspace = true }
1212

13+
[package.metadata.docs.rs]
14+
targets = ["x86_64-unknown-linux-gnu"]
15+
all-features = true
16+
rustdoc-args = ["--cfg=docsrs"]
17+
1318
[lib]
1419
crate-type = ["rlib"]
1520

bls-signatures/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![no_std]
2+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
23
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
34

45
extern crate alloc;

bn254/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ license = { workspace = true }
1010
edition = { workspace = true }
1111
include = ["src/**/*"]
1212

13+
[package.metadata.docs.rs]
14+
targets = ["x86_64-unknown-linux-gnu"]
15+
all-features = true
16+
rustdoc-args = ["--cfg=docsrs"]
17+
1318
[dependencies]
1419
bytemuck = { workspace = true, features = ["derive"] }
1520
thiserror = { workspace = true }

bn254/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
12
pub(crate) mod addition;
23
pub mod compression;
34
pub(crate) mod multiplication;

0 commit comments

Comments
 (0)