Skip to content

Commit

Permalink
Fix some #[cfg_attr(not(doc), repr(..))]
Browse files Browse the repository at this point in the history
Now that rust-lang#90435 seems to have been resolved.
  • Loading branch information
GrigorenkoPV committed Jul 21, 2024
1 parent 92c6c03 commit b74f426
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ where
/// ```
///
#[unstable(feature = "error_generic_member_access", issue = "99301")]
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
#[repr(transparent)]
pub struct Request<'a>(Tagged<dyn Erased<'a> + 'a>);

impl<'a> Request<'a> {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ use crate::str;
// However, `CStr` layout is considered an implementation detail and must not be relied upon. We
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
#[cfg_attr(not(doc), repr(transparent))]
#[repr(transparent)]
#[allow(clippy::derived_hash_with_manual_eq)]
pub struct CStr {
// FIXME: this should not be represented with a DST slice but rather with
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod c_long_definition {
// be UB.
#[doc = include_str!("c_void.md")]
#[lang = "c_void"]
#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
#[cfg_attr(not(doc), repr(u8))] // An implementation detail we don't want to show up in rustdoc
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
#[unstable(
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ffi/va_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::ops::{Deref, DerefMut};
target_os = "uefi",
windows,
))]
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
#[repr(transparent)]
#[lang = "va_list"]
pub struct VaListImpl<'f> {
ptr: *mut c_void,
Expand Down Expand Up @@ -115,7 +115,7 @@ pub struct VaListImpl<'f> {
}

/// A wrapper for a `va_list`
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
#[repr(transparent)]
#[derive(Debug)]
pub struct VaList<'a, 'f: 'a> {
#[cfg(any(
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl<'a> ContextBuilder<'a> {
/// [`Future::poll()`]: core::future::Future::poll
/// [`Poll::Pending`]: core::task::Poll::Pending
/// [`Wake`]: ../../alloc/task/trait.Wake.html
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
#[repr(transparent)]
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct Waker {
waker: RawWaker,
Expand Down Expand Up @@ -695,7 +695,7 @@ impl fmt::Debug for Waker {
/// [`Poll::Pending`]: core::task::Poll::Pending
/// [`local_waker`]: core::task::Context::local_waker
#[unstable(feature = "local_waker", issue = "118959")]
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
#[repr(transparent)]
pub struct LocalWaker {
waker: RawWaker,
}
Expand Down
6 changes: 2 additions & 4 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ impl crate::sealed::Sealed for OsString {}
#[stable(feature = "rust1", since = "1.0.0")]
// `OsStr::from_inner` current implementation relies
// on `OsStr` being layout-compatible with `Slice`.
// However, `OsStr` layout is considered an implementation detail and must not be relied upon. We
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
#[cfg_attr(not(doc), repr(transparent))]
// However, `OsStr` layout is considered an implementation detail and must not be relied upon.
#[repr(transparent)]
pub struct OsStr {
inner: Slice,
}
Expand Down
6 changes: 2 additions & 4 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2079,10 +2079,8 @@ impl AsRef<OsStr> for PathBuf {
#[stable(feature = "rust1", since = "1.0.0")]
// `Path::new` current implementation relies
// on `Path` being layout-compatible with `OsStr`.
// However, `Path` layout is considered an implementation detail and must not be relied upon. We
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
#[cfg_attr(not(doc), repr(transparent))]
// However, `Path` layout is considered an implementation detail and must not be relied upon.
#[repr(transparent)]
pub struct Path {
inner: OsStr,
}
Expand Down

0 comments on commit b74f426

Please sign in to comment.