From 5dd3e5e2bfd1df6e9dda18de508dc1a10cb37e7a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 4 May 2026 00:05:38 +0200 Subject: [PATCH] Add a `doc_cfg` regression test to ensure foreign types impls are working as expected --- tests/rustdoc-html/doc-cfg/impl-foreign-type.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/rustdoc-html/doc-cfg/impl-foreign-type.rs diff --git a/tests/rustdoc-html/doc-cfg/impl-foreign-type.rs b/tests/rustdoc-html/doc-cfg/impl-foreign-type.rs new file mode 100644 index 0000000000000..e4697c5b8dbef --- /dev/null +++ b/tests/rustdoc-html/doc-cfg/impl-foreign-type.rs @@ -0,0 +1,15 @@ +// This test ensures that the `doc_cfg` feature works on foreign types impl. +// Regression test for . + +// ignore-tidy-linelength + +#![feature(doc_cfg)] +#![crate_name = "foo"] + +//@has 'foo/trait.Blob.html' +//@has - '//*[@id="impl-Blob-for-Box%3CR%3E"]//*[@class="stab portability"]' 'Available on non-crate feature alloc only.' + +pub trait Blob {} + +#[cfg(not(feature = "alloc"))] +impl Blob for std::boxed::Box {}