about summary refs log tree commit diff
path: root/tests/rustdoc-json
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-05-17 14:38:26 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2025-05-22 21:26:48 +0200
commit98bd1a6a3a56951b2fe676988d8cb005a6b752c5 (patch)
treed21aee17a00d11c84ad16163825db91987662cef /tests/rustdoc-json
parente3892a40a9d06034fdf2432a9d3d29fa97726299 (diff)
downloadrust-98bd1a6a3a56951b2fe676988d8cb005a6b752c5.tar.gz
rust-98bd1a6a3a56951b2fe676988d8cb005a6b752c5.zip
rustdoc JSON: Don't apply `#[repr]` privacy heuristics
Diffstat (limited to 'tests/rustdoc-json')
-rw-r--r--tests/rustdoc-json/attrs/repr_combination.rs4
-rw-r--r--tests/rustdoc-json/attrs/repr_transparent.rs37
2 files changed, 4 insertions, 37 deletions
diff --git a/tests/rustdoc-json/attrs/repr_combination.rs b/tests/rustdoc-json/attrs/repr_combination.rs
index 0e8e2ef0d83..6fe29c5eac0 100644
--- a/tests/rustdoc-json/attrs/repr_combination.rs
+++ b/tests/rustdoc-json/attrs/repr_combination.rs
@@ -77,3 +77,7 @@ pub enum AlignedExplicitRepr {
 pub enum ReorderedAlignedExplicitRepr {
     First,
 }
+
+//@ is "$.index[?(@.name=='Transparent')].attrs" '["#[repr(transparent)]"]'
+#[repr(transparent)]
+pub struct Transparent(i64);
diff --git a/tests/rustdoc-json/attrs/repr_transparent.rs b/tests/rustdoc-json/attrs/repr_transparent.rs
deleted file mode 100644
index 1e634ca901d..00000000000
--- a/tests/rustdoc-json/attrs/repr_transparent.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![no_std]
-
-// Rustdoc JSON *only* includes `#[repr(transparent)]`
-// if the transparency is public API:
-// - if a non-1-ZST field exists, it has to be public
-// - otherwise, all fields are 1-ZST and at least one of them is public
-//
-// More info: https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
-
-// Here, the non-1-ZST field is public.
-// We expect `#[repr(transparent)]` in the attributes.
-//
-//@ is "$.index[?(@.name=='Transparent')].attrs" '["#[repr(transparent)]"]'
-#[repr(transparent)]
-pub struct Transparent(pub i64);
-
-// Here the non-1-ZST field isn't public, so the attribute isn't included.
-//
-//@ has "$.index[?(@.name=='TransparentNonPub')]"
-//@ is "$.index[?(@.name=='TransparentNonPub')].attrs" '[]'
-#[repr(transparent)]
-pub struct TransparentNonPub(i64);
-
-// Only 1-ZST fields here, and one of them is public.
-// We expect `#[repr(transparent)]` in the attributes.
-//
-//@ is "$.index[?(@.name=='AllZst')].attrs" '["#[repr(transparent)]"]'
-#[repr(transparent)]
-pub struct AllZst<'a>(pub core::marker::PhantomData<&'a ()>, ());
-
-// Only 1-ZST fields here but none of them are public.
-// The attribute isn't included.
-//
-//@ has "$.index[?(@.name=='AllZstNotPublic')]"
-//@ is "$.index[?(@.name=='AllZstNotPublic')].attrs" '[]'
-#[repr(transparent)]
-pub struct AllZstNotPublic<'a>(core::marker::PhantomData<&'a ()>, ());