@@ -1158,14 +1158,11 @@ 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.
1167- // For now we just hide this from rustdoc, technically making our doc test builds rely on
1168- // unspecified layout assumptions. We are std, so we can get away with that.
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.
11691166#[cfg_attr(not(doc), repr(transparent))]
11701167pub struct PathBuf {
11711168 inner: OsString,
@@ -1986,14 +1983,11 @@ impl AsRef<OsStr> for PathBuf {
19861983/// ```
19871984#[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
19881985#[stable(feature = "rust1", since = "1.0.0")]
1989- // FIXME:
19901986// `Path::new` current implementation relies
19911987// on `Path` being layout-compatible with `OsStr`.
1992- // When attribute privacy is implemented, `Path` should be annotated as `#[repr(transparent)]`.
1993- // Anyway, `Path` representation and layout are considered implementation detail, are
1994- // not documented and must not be relied upon.
1995- // For now we just hide this from rustdoc, technically making our doc test builds rely on
1996- // unspecified layout assumptions. We are std, so we can get away with that.
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.
19971991#[cfg_attr(not(doc), repr(transparent))]
19981992pub struct Path {
19991993 inner: OsStr,
0 commit comments