File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -772,7 +772,15 @@ impl Item {
772
772
. other_attrs
773
773
. iter ( )
774
774
. filter_map ( |attr| {
775
- if keep_as_is {
775
+ // We have separate pretty-printing logic for `#[repr(..)]` attributes.
776
+ // For example, there are circumstances where `#[repr(transparent)]` is applied
777
+ // but should not be publicly shown in rustdoc because it isn't public API.
778
+ if keep_as_is
779
+ && !matches ! (
780
+ attr,
781
+ rustc_hir:: Attribute :: Parsed ( rustc_attr_parsing:: AttributeKind :: Repr ( ..) )
782
+ )
783
+ {
776
784
Some ( rustc_hir_pretty:: attribute_to_string ( & tcx, attr) )
777
785
} else if ALLOWED_ATTRIBUTES . contains ( & attr. name_or_empty ( ) ) {
778
786
Some (
@@ -786,8 +794,7 @@ impl Item {
786
794
}
787
795
} )
788
796
. collect ( ) ;
789
- if !keep_as_is
790
- && let Some ( def_id) = self . def_id ( )
797
+ if let Some ( def_id) = self . def_id ( )
791
798
&& let ItemType :: Struct | ItemType :: Enum | ItemType :: Union = self . type_ ( )
792
799
{
793
800
let adt = tcx. adt_def ( def_id) ;
You can’t perform that action at this time.
0 commit comments