@@ -1158,12 +1158,12 @@ impl FusedIterator for Ancestors<'_> {}
11581158/// Which method works best depends on what kind of situation you're in.
11591159#[ cfg_attr( not( test) , rustc_diagnostic_item = "PathBuf" ) ]
11601160#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1161- // FIXME:
11621161// `PathBuf::as_mut_vec` current implementation relies
11631162// on `PathBuf` being layout-compatible with `Vec<u8>`.
1164- // When attribute privacy is implemented, `PathBuf` should be annotated as `#[repr(transparent)]`.
1165- // Anyway, `PathBuf` representation and layout are considered implementation detail, are
1166- // not documented and must not be relied upon.
1163+ // However, `PathBuf` layout is considered an implementation detail and must not be relied upon. We
1164+ // want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
1165+ // `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
1166+ #[ cfg_attr( not( doc) , repr( transparent) ) ]
11671167pub struct PathBuf {
11681168 inner : OsString ,
11691169}
@@ -1983,12 +1983,12 @@ impl AsRef<OsStr> for PathBuf {
19831983/// ```
19841984#[ cfg_attr( not( test) , rustc_diagnostic_item = "Path" ) ]
19851985#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1986- // FIXME:
19871986// `Path::new` current implementation relies
19881987// on `Path` being layout-compatible with `OsStr`.
1989- // When attribute privacy is implemented, `Path` should be annotated as `#[repr(transparent)]`.
1990- // Anyway, `Path` representation and layout are considered implementation detail, are
1991- // not documented and must not be relied upon.
1988+ // However, `Path` layout is considered an implementation detail and must not be relied upon. We
1989+ // want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
1990+ // `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
1991+ #[ cfg_attr( not( doc) , repr( transparent) ) ]
19921992pub struct Path {
19931993 inner : OsStr ,
19941994}
0 commit comments