Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bbe4da8

Browse files
committedJul 21, 2024
Fix some #[cfg_attr(not(doc), repr(..))]
Now that rust-lang#90435 seems to have been resolved.
1 parent 2fff48d commit bbe4da8

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed
 

‎core/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ where
506506
/// ```
507507
///
508508
#[unstable(feature = "error_generic_member_access", issue = "99301")]
509-
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
509+
#[repr(transparent)]
510510
pub struct Request<'a>(Tagged<dyn Erased<'a> + 'a>);
511511

512512
impl<'a> Request<'a> {

‎core/src/ffi/c_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ use crate::str;
103103
// However, `CStr` layout is considered an implementation detail and must not be relied upon. We
104104
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
105105
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
106-
#[cfg_attr(not(doc), repr(transparent))]
106+
#[repr(transparent)]
107107
#[allow(clippy::derived_hash_with_manual_eq)]
108108
pub struct CStr {
109109
// FIXME: this should not be represented with a DST slice but rather with

‎core/src/ffi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ mod c_long_definition {
191191
// be UB.
192192
#[doc = include_str!("c_void.md")]
193193
#[lang = "c_void"]
194-
#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
194+
#[cfg_attr(not(doc), repr(u8))] // An implementation detail we don't want to show up in rustdoc
195195
#[stable(feature = "core_c_void", since = "1.30.0")]
196196
pub enum c_void {
197197
#[unstable(

‎core/src/ffi/va_list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::ops::{Deref, DerefMut};
2323
target_os = "uefi",
2424
windows,
2525
))]
26-
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
26+
#[repr(transparent)]
2727
#[lang = "va_list"]
2828
pub struct VaListImpl<'f> {
2929
ptr: *mut c_void,
@@ -115,7 +115,7 @@ pub struct VaListImpl<'f> {
115115
}
116116

117117
/// A wrapper for a `va_list`
118-
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
118+
#[repr(transparent)]
119119
#[derive(Debug)]
120120
pub struct VaList<'a, 'f: 'a> {
121121
#[cfg(any(

‎core/src/task/wake.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<'a> ContextBuilder<'a> {
429429
/// [`Future::poll()`]: core::future::Future::poll
430430
/// [`Poll::Pending`]: core::task::Poll::Pending
431431
/// [`Wake`]: ../../alloc/task/trait.Wake.html
432-
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
432+
#[repr(transparent)]
433433
#[stable(feature = "futures_api", since = "1.36.0")]
434434
pub struct Waker {
435435
waker: RawWaker,
@@ -695,7 +695,7 @@ impl fmt::Debug for Waker {
695695
/// [`Poll::Pending`]: core::task::Poll::Pending
696696
/// [`local_waker`]: core::task::Context::local_waker
697697
#[unstable(feature = "local_waker", issue = "118959")]
698-
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
698+
#[repr(transparent)]
699699
pub struct LocalWaker {
700700
waker: RawWaker,
701701
}

‎std/src/ffi/os_str.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ impl crate::sealed::Sealed for OsString {}
115115
#[stable(feature = "rust1", since = "1.0.0")]
116116
// `OsStr::from_inner` current implementation relies
117117
// on `OsStr` being layout-compatible with `Slice`.
118-
// However, `OsStr` layout is considered an implementation detail and must not be relied upon. We
119-
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
120-
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
121-
#[cfg_attr(not(doc), repr(transparent))]
118+
// However, `OsStr` layout is considered an implementation detail and must not be relied upon.
119+
#[repr(transparent)]
122120
pub struct OsStr {
123121
inner: Slice,
124122
}

‎std/src/path.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2079,10 +2079,8 @@ impl AsRef<OsStr> for PathBuf {
20792079
#[stable(feature = "rust1", since = "1.0.0")]
20802080
// `Path::new` current implementation relies
20812081
// on `Path` being layout-compatible with `OsStr`.
2082-
// However, `Path` layout is considered an implementation detail and must not be relied upon. We
2083-
// want `repr(transparent)` but we don't want it to show up in rustdoc, so we hide it under
2084-
// `cfg(doc)`. This is an ad-hoc implementation of attribute privacy.
2085-
#[cfg_attr(not(doc), repr(transparent))]
2082+
// However, `Path` layout is considered an implementation detail and must not be relied upon.
2083+
#[repr(transparent)]
20862084
pub struct Path {
20872085
inner: OsStr,
20882086
}

0 commit comments

Comments
 (0)
Failed to load comments.