Rollup merge of #156122 - GuillaumeGomez:doc-cfg-test, r=Urgau

Add a `doc_cfg` regression test to ensure foreign types impls are working as expected

Fixes https://github.com/rust-lang/rust/issues/150268.

This is the last case mentioned in the issue that wasn't tested. With this, the issue can be closed.

r? @Urgau
This commit is contained in:
Guillaume Gomez
2026-05-05 02:50:13 +02:00
committed by GitHub
@@ -0,0 +1,15 @@
// This test ensures that the `doc_cfg` feature works on foreign types impl.
// Regression test for <https://github.com/rust-lang/rust/issues/150268>.
// 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<R: ?Sized> Blob for std::boxed::Box<R> {}