From d25a7f5ca33ddeafa2231c486b5dc282a192e5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Fri, 7 Aug 2026 13:58:44 +0200 Subject: [PATCH] fix(multitude): gate over-aligned doctest behind utc_backend cfg The doctest on AllocError::is_alignment_too_large declares a type with repr(align(32768)) to trigger the alignment-too-large rejection. Codegen backends that support a lower maximum type alignment cannot compile it, so cargo test --doc failed there. #501 gated the equivalent integration tests behind cfg(utc_backend) but missed this doctest. Wrap the body in the hidden cfg shim documented in AGENTS-feature-gated-doctests.md so it compiles in both configurations. Note that doctests are compiled by rustdoc, so enabling the gate requires RUSTDOCFLAGS in addition to RUSTFLAGS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/multitude/src/error.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/multitude/src/error.rs b/crates/multitude/src/error.rs index e8710d159..e8f89adad 100644 --- a/crates/multitude/src/error.rs +++ b/crates/multitude/src/error.rs @@ -95,6 +95,8 @@ impl AllocError { /// succeed, regardless of how much memory is available. /// /// ``` + /// # fn main() { + /// # #[cfg(not(utc_backend))] { /// #[repr(align(32768))] /// struct OverAligned; /// @@ -103,6 +105,8 @@ impl AllocError { /// panic!("over-aligned values must be rejected"); /// }; /// assert!(error.is_alignment_too_large()); + /// # } + /// # } /// ``` #[must_use] pub fn is_alignment_too_large(self) -> bool {