Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Run ShellCheck
run: ./scripts/check-shell.sh

- name: Check doc features
run: ./scripts/check-doc-features.sh

check-crates:
name: Check crate ownership
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ check-cfg = [
'cfg(feature, values("frozen-abi", "no-entrypoint"))',
]

[workspace.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[workspace.metadata.release]
pre-release-commit-message = "Publish {{crate_name}} v{{version}}"
tag-message = "Publish {{crate_name}} v{{version}}"
Expand Down
5 changes: 5 additions & 0 deletions address/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[features]
atomic = ["dep:solana-atomic-u64"]
borsh = ["dep:borsh", "std"]
Expand Down
1 change: 1 addition & 0 deletions atomic-u64/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use implementation::AtomicU64;

#[cfg(target_pointer_width = "64")]
Expand Down
1 change: 1 addition & 0 deletions big-mod-exp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[repr(C)]
pub struct BigModExpParams {
pub base: *const u8,
Expand Down
1 change: 1 addition & 0 deletions bincode/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Contains a single utility function for deserializing from [bincode].
//!
//! [bincode]: https://docs.rs/bincode
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

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

Expand Down
5 changes: 5 additions & 0 deletions bls-signatures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["rlib"]

Expand Down
1 change: 1 addition & 0 deletions bls-signatures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]

extern crate alloc;
Expand Down
5 changes: 5 additions & 0 deletions bn254/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ license = { workspace = true }
edition = { workspace = true }
include = ["src/**/*"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[dependencies]
bytemuck = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions bn254/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub(crate) mod addition;
pub mod compression;
pub(crate) mod multiplication;
Expand Down
1 change: 1 addition & 0 deletions borsh/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod macros;
pub mod v1;
1 change: 1 addition & 0 deletions client-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//!
//! Asynchronous implementations are expected to create transactions, sign them, and send
//! them but without waiting to see if the server accepted it.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
solana_account::Account,
Expand Down
1 change: 1 addition & 0 deletions commitment-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Definitions of commitment levels.
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use core::{fmt, str::FromStr};

#[cfg_attr(
Expand Down
1 change: 1 addition & 0 deletions cpi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//! [`invoke_signed`]: invoke_signed
//! [cpi]: https://solana.com/docs/core/cpi
//! [`solana_program::program`]: https://docs.rs/solana-program/latest/solana_program/program/
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
solana_account_info::AccountInfo, solana_instruction::Instruction,
Expand Down
1 change: 1 addition & 0 deletions define-syscall/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod definitions;

Expand Down
1 change: 1 addition & 0 deletions derivation-path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! > `m/44'/501'`
//!
//! with 501 being the Solana coin type.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
core::{iter::IntoIterator, slice::Iter},
Expand Down
1 change: 1 addition & 0 deletions ed25519-program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Instructions for the [ed25519 native program][np].
//!
//! [np]: https://docs.solanalabs.com/runtime/programs#ed25519-program
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
bytemuck::bytes_of,
Expand Down
1 change: 1 addition & 0 deletions epoch-info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! As returned by the [`getEpochInfo`] RPC method.
//!
//! [`getEpochInfo`]: https://solana.com/docs/rpc/http/getepochinfo
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

#[cfg_attr(
feature = "serde",
Expand Down
1 change: 1 addition & 0 deletions epoch-rewards-hasher/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use {siphasher::sip::SipHasher13, solana_hash::Hash, solana_pubkey::Pubkey, std::hash::Hasher};

#[derive(Debug, Clone)]
Expand Down
1 change: 1 addition & 0 deletions epoch-schedule/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//!
//! [`DEFAULT_SLOTS_PER_EPOCH`]: https://docs.rs/solana-clock/latest/solana_clock/constant.DEFAULT_SLOTS_PER_EPOCH.html
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![no_std]
#[cfg(feature = "frozen-abi")]
extern crate std;
Expand Down
1 change: 1 addition & 0 deletions epoch-stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! On-chain programs can use this API to retrieve the total stake for the
//! current epoch or the stake for a specific vote account using the
//! `sol_get_epoch_stake` syscall.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use solana_pubkey::Pubkey;

Expand Down
1 change: 1 addition & 0 deletions feature-gate-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//! `Feature::default()`
//! 2. When the next epoch is entered the runtime will check for new activation requests and
//! active them. When this occurs, the activation slot is recorded in the feature account
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod error;
pub mod instruction;
Expand Down
1 change: 1 addition & 0 deletions file-download/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::arithmetic_side_effects)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use {
console::Emoji,
indicatif::{ProgressBar, ProgressStyle},
Expand Down
5 changes: 5 additions & 0 deletions frozen-abi-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
proc-macro = true

Expand Down
1 change: 1 addition & 0 deletions frozen-abi-macro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
extern crate proc_macro;

use proc_macro::TokenStream;
Expand Down
5 changes: 5 additions & 0 deletions frozen-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[features]
default = []
# activate the frozen-abi feature when we actually want to do frozen-abi testing,
Expand Down
1 change: 1 addition & 0 deletions frozen-abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(incomplete_features)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(specialization))]

// Allows macro expansion of `use ::solana_frozen_abi::*` to work within this crate
Expand Down
1 change: 1 addition & 0 deletions hard-forks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! The list of slot boundaries at which a hard fork should
//! occur.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]

#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand Down
1 change: 1 addition & 0 deletions inflation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! configuration for network inflation
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
Expand Down
1 change: 1 addition & 0 deletions instruction-error/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#[cfg(feature = "num-traits")]
use num_traits::ToPrimitive;
Expand Down
1 change: 1 addition & 0 deletions logger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! The `logger` module configures `env_logger`
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
lazy_static::lazy_static,
Expand Down
1 change: 1 addition & 0 deletions msg/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[cfg(feature = "std")]
extern crate std;
/// Print a message to the log.
Expand Down
1 change: 1 addition & 0 deletions native-token/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Definitions for the native SOL token and its fractional lamports.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(clippy::arithmetic_side_effects)]

/// There are 10^9 lamports in one SOL
Expand Down
1 change: 1 addition & 0 deletions nonce-account/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Functions related to nonce accounts.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use {
solana_account::{state_traits::StateMut, AccountSharedData, ReadableAccount},
Expand Down
1 change: 1 addition & 0 deletions package-metadata-macro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Macro to access data from the `package.metadata` section of Cargo.toml
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate proc_macro;

Expand Down
1 change: 1 addition & 0 deletions package-metadata/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
/// Macro for accessing data from the `package.metadata` section of the Cargo manifest
///
/// # Arguments
Expand Down
1 change: 1 addition & 0 deletions precompile-error/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
/// Precompile errors
use core::fmt;

Expand Down
1 change: 1 addition & 0 deletions presigner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use solana_signer::PresignerError;
use {
solana_pubkey::Pubkey,
Expand Down
1 change: 1 addition & 0 deletions program-entrypoint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! The Rust-based BPF program entrypoint supported by the latest BPF loader.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate alloc;
use {
Expand Down
1 change: 1 addition & 0 deletions program-memory/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

//! Basic low-level memory operations.
//!
Expand Down
1 change: 1 addition & 0 deletions program-option/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//!
//! This implementation mostly matches `std::option` except iterators since the iteration
//! trait requires returning `std::option::Option`
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use std::{
convert, mem,
Expand Down
1 change: 1 addition & 0 deletions program-pack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! serialization format.
//!
//! [spl]: https://github.com/solana-labs/solana-program-library
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use solana_program_error::ProgramError;

Expand Down
1 change: 1 addition & 0 deletions quic-definitions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Definitions related to Solana over QUIC.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use {solana_keypair::Keypair, std::time::Duration};

pub const QUIC_PORT_OFFSET: u16 = 6;
Expand Down
1 change: 1 addition & 0 deletions rent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#![allow(clippy::arithmetic_side_effects)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#[cfg(feature = "frozen-abi")]
extern crate std;
Expand Down
1 change: 1 addition & 0 deletions reward-info/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
#[cfg(feature = "frozen-abi")]
Expand Down
1 change: 1 addition & 0 deletions sanitize/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! A trait for sanitizing values and members of over the wire messages.

#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use core::{error::Error, fmt};

Expand Down
24 changes: 24 additions & 0 deletions scripts/check-doc-features.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -eo pipefail
here="$(dirname "$0")"
src_root="$(readlink -f "${here}/..")"
cd "${src_root}"

err=0
# Get all Cargo.toml files that don't have [package.metadata.docs.rs] specified
files=$(comm -23 <(git ls-files -- '**/Cargo.toml' | sort) <(git grep -l "^\[package.metadata.docs.rs\]" | sort))
if [[ -n $files ]]; then
echo "Files found without [package.metadata.docs.rs]:"
echo "$files"
err=1
fi

# Get all lib.rs files that don't have #![cfg_attr(docsrs, feature(doc_auto_cfg))]
files=$(comm -23 <(git ls-files -- '**/lib.rs' | sort) <(git grep -lE '^#!\[cfg_attr\(docsrs, feature\(doc_auto_cfg\)\)\]' | sort))
if [[ -n $files ]]; then
echo "Files found without #![cfg_attr(docsrs, feature(doc_auto_cfg))]"
echo "$files"
err=1
fi
exit $err
1 change: 1 addition & 0 deletions sdk-ids/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod address_lookup_table {
solana_pubkey::declare_id!("AddressLookupTab1e1111111111111111111111111");
Expand Down
1 change: 1 addition & 0 deletions sdk-macro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Convenience macro to declare a static public key and functions to interact with it
//!
//! Input: a single literal base58 string representation of a program's id
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate proc_macro;

Expand Down
5 changes: 5 additions & 0 deletions sdk-wasm-js-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]

Expand Down
1 change: 1 addition & 0 deletions sdk-wasm-js-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! `SystemInstruction` Javascript interface
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg(target_arch = "wasm32")]
#![allow(non_snake_case)]
pub use solana_sdk_wasm_js::{
Expand Down
1 change: 1 addition & 0 deletions sdk-wasm-js/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! solana-program Javascript interface
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg(target_arch = "wasm32")]

use {
Expand Down
Loading