From f5fb8d1e78c20a12a390c721dc624aff88a49697 Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Thu, 26 Dec 2024 21:07:49 -0500 Subject: [PATCH] fix cfg and features --- .github/workflows/ci.yml | 2 +- .github/workflows/weekly.yml | 6 ++++-- Cargo.toml | 23 +++++++++++++++++++++++ README.md | 2 +- benches/Cargo.toml | 4 ---- examples/demonstrations/all_tuples.rs | 5 +++++ src/lib.rs | 4 +++- 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58d0224..66855b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: toolchain: stable - name: Check Compile run: | - cargo test --target-dir ../../../target + cargo test --workspace cargo check --benches --target-dir ../target --manifest-path ./benches/Cargo.toml cargo check --workspace --examples cargo check --workspace diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index cf8ff1a..6f8037e 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -59,7 +59,7 @@ jobs: toolchain: stable - name: Check Compile run: | - cargo test --target-dir ../../../target + cargo test --workspace cargo check --benches --target-dir ../target --manifest-path ./benches/Cargo.toml cargo check --workspace --examples cargo check --workspace @@ -72,7 +72,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@beta - name: Build and check docs - run: cargo run -p ci -- doc + run: | + cargo test --workspace --doc --no-fail-fast + cargo doc --workspace --all-features --no-deps --document-private-items --keep-going env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0 --cfg docsrs_dep" diff --git a/Cargo.toml b/Cargo.toml index 2ca1ce1..c7bfc39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,29 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] } unsafe_code = "deny" unsafe_op_in_unsafe_fn = "warn" unused_qualifications = "warn" +internal_features = { level = "allow" } + +[lints.rust] +missing_docs = "warn" +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] } +unsafe_code = "deny" +unsafe_op_in_unsafe_fn = "warn" +unused_qualifications = "warn" +internal_features = { level = "allow" } + +[profile.release] +opt-level = 3 +lto = true + +[package.metadata.docs.rs] +# This cfg is needed so that #[doc(fake_variadic)] is correctly propagated for +# impls for re-exported traits. See https://github.com/rust-lang/cargo/issues/8811 +# for details on why this is needed. Since dependencies don't expect to be built +# with `--cfg docsrs` (and thus fail to compile), we use a different cfg. +rustc-args = ["--cfg", "docsrs_dep"] +rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"] +all-features = true +cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] # Examples diff --git a/README.md b/README.md index 77cf841..a358a1e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Downloads](https://img.shields.io/crates/d/variadics_please.svg)](https://crates.io/crates/variadics_please) [![Docs](https://docs.rs/variadics_please/badge.svg)](https://docs.rs/variadics_please/latest/variadics_please/) -Provides a macro for implementing traits on variadic types. +Provides macros for implementing traits on variadic types. ## Contributing diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 9a61f2b..9bb72f5 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -10,10 +10,6 @@ rand = "0.8" rand_chacha = "0.3" criterion = { version = "0.3", features = ["html_reports"] } -[profile.release] -opt-level = 3 -lto = true - [[bench]] name = "dummy" path = "benches/dummy.rs" diff --git a/examples/demonstrations/all_tuples.rs b/examples/demonstrations/all_tuples.rs index 0d89270..0c3c0b6 100644 --- a/examples/demonstrations/all_tuples.rs +++ b/examples/demonstrations/all_tuples.rs @@ -1,9 +1,14 @@ +//! An example of using `all_tuples!` + use variadics_please::all_tuples; fn main() {} +/// For demonstration pub trait Foo { + /// For demonstration const FOO_HARDER: bool; + /// For demonstration fn foo() -> bool; } diff --git a/src/lib.rs b/src/lib.rs index dfc5775..c7c1e64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ +//! Provides macros for implementing traits on variadic types. + // FIXME(15321): solve CI failures, then replace with `#![expect()]`. #![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] -#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))] use proc_macro::TokenStream; use proc_macro2::{Literal, Span as Span2, TokenStream as TokenStream2};