Skip to content

Commit 31ca6af

Browse files
ctzdjc
authored andcommitted
Avoid use of docsrs cfg
cfg is a global namespace, and we don't want to trigger this in dependencies.
1 parent b4597ca commit 31ca6af

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# keep features in sync with Cargo.toml `[package.metadata.docs.rs]` section
4242
run: cargo doc --locked --features read_buf,ring --no-deps --package rustls
4343
env:
44-
RUSTDOCFLAGS: -Dwarnings --cfg=docsrs --html-after-content tag.html
44+
RUSTDOCFLAGS: -Dwarnings --cfg=rustls_docsrs --html-after-content tag.html
4545

4646
- name: Generate other pages
4747
run: |

rustls/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ path = "tests/runners/unbuffered.rs"
114114
[package.metadata.docs.rs]
115115
# all non-default features except fips (cannot build on docs.rs environment)
116116
features = ["read_buf", "ring"]
117-
rustdoc-args = ["--cfg", "docsrs"]
117+
rustdoc-args = ["--cfg", "rustls_docsrs"]
118118

119119
[package.metadata.cargo_check_external_types]
120120
allowed_external_types = [
@@ -127,4 +127,9 @@ allowed_external_types = [
127127
enum_no_repr_variant_discriminant_changed = "warn"
128128

129129
[lints.rust]
130-
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(bench)", "cfg(coverage_nightly)", "cfg(read_buf)"] }
130+
unexpected_cfgs = { level = "warn", check-cfg = [
131+
"cfg(bench)",
132+
"cfg(coverage_nightly)",
133+
"cfg(read_buf)",
134+
"cfg(rustls_docsrs)",
135+
] }

rustls/src/crypto/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ impl From<Vec<u8>> for SharedSecret {
690690
/// .with_no_client_auth();
691691
/// # }
692692
/// ```
693-
#[cfg(all(feature = "aws_lc_rs", any(feature = "fips", docsrs)))]
694-
#[cfg_attr(docsrs, doc(cfg(feature = "fips")))]
693+
#[cfg(all(feature = "aws_lc_rs", any(feature = "fips", rustls_docsrs)))]
694+
#[cfg_attr(rustls_docsrs, doc(cfg(feature = "fips")))]
695695
pub fn default_fips_provider() -> CryptoProvider {
696696
aws_lc_rs::default_provider()
697697
}

rustls/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@
364364
clippy::new_without_default
365365
)]
366366
// Enable documentation for all features on docs.rs
367-
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
367+
#![cfg_attr(rustls_docsrs, feature(doc_cfg, doc_auto_cfg))]
368368
// Enable coverage() attr for nightly coverage builds, see
369369
// <https://github.com/rust-lang/rust/issues/84605>
370370
// (`coverage_nightly` is a cfg set by `cargo-llvm-cov`)

0 commit comments

Comments
 (0)