@@ -1158,12 +1158,12 @@ impl FusedIterator for Ancestors<'_> {}
1158
1158
/// Which method works best depends on what kind of situation you're in.
1159
1159
#[ cfg_attr( not( test) , rustc_diagnostic_item = "PathBuf" ) ]
1160
1160
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1161
- // FIXME:
1162
1161
// `PathBuf::as_mut_vec` current implementation relies
1163
1162
// 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) ) ]
1167
1167
pub struct PathBuf {
1168
1168
inner : OsString ,
1169
1169
}
@@ -1983,12 +1983,12 @@ impl AsRef<OsStr> for PathBuf {
1983
1983
/// ```
1984
1984
#[ cfg_attr( not( test) , rustc_diagnostic_item = "Path" ) ]
1985
1985
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1986
- // FIXME:
1987
1986
// `Path::new` current implementation relies
1988
1987
// 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) ) ]
1992
1992
pub struct Path {
1993
1993
inner : OsStr ,
1994
1994
}
0 commit comments