Skip to content

Conversation

@algesten
Copy link
Owner

@algesten algesten commented Feb 2, 2026

Summary

Fixes doctest failures when running tests with only the rust-crypto feature enabled (without aws-lc-rs or rcgen features).

The failing doctests were:

  • src/crypto/provider.rs line 29 - uses certificate and aws_lc_rs modules
  • src/crypto/provider.rs line 307 - uses aws_lc_rs module
  • src/crypto/provider.rs line 371 - uses aws_lc_rs module
  • src/crypto/rust_crypto/mod.rs line 21 - uses certificate module

These modules are gated behind rcgen and aws-lc-rs features respectively, causing compilation failures like:

error[E0432]: unresolved import `dimpl::crypto::aws_lc_rs`
note: found an item that was configured out
   --> src/crypto/mod.rs:13:9
    |
 12 | #[cfg(feature = "aws-lc-rs")]
    |       --------------------- the item is gated behind the `aws-lc-rs` feature

Changes

  • Wrap feature-gated doctest code in hidden # if cfg!(feature = "...") blocks
  • Tests compile and run when features are enabled, compile as empty when disabled

Test plan

  • CI should now pass for test_features (ubuntu-latest, beta, rust-crypto) job
  • Documentation examples remain visible and useful for readers
  • Examples still get tested when the required features are enabled

🤖 Generated with Claude Code

algesten and others added 6 commits February 2, 2026 10:24
The doctests for CryptoProvider examples reference `aws_lc_rs` and
`certificate` modules which are gated behind `aws-lc-rs` and `rcgen`
features respectively. When running tests with only `rust-crypto`
feature enabled, these doctests fail to compile.

Mark these examples with `ignore` and add comments documenting the
required features.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The module-level doctest uses the `certificate` module which requires
the `rcgen` feature. Mark it with `ignore` and document the requirement.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use hidden `# if cfg!(feature = "...")` blocks to conditionally compile
doctests based on required features, rather than ignoring them entirely.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use hidden `# if cfg!(feature = "...")` block to conditionally compile
the doctest based on required features.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cfg!() macro is evaluated at runtime, not compile time, so it
doesn't prevent the code from being compiled. Use #[cfg(...)] attributes
on wrapper functions instead to conditionally compile doctests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The cfg!() macro is evaluated at runtime, not compile time. Use #[cfg]
attribute on wrapper functions to conditionally compile the doctest.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The doctests use the `certificate` module which requires the `rcgen`
feature. Add #[cfg] wrapper functions to conditionally compile them.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@algesten algesten merged commit 516daad into main Feb 2, 2026
43 checks passed
@algesten algesten deleted the fix-doctest-feature-gates branch February 2, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants