-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate use of #[cfg_attr(not(doc), repr(...))]
#116743
Closed
+24
−32
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,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 | ||
#[repr(u8)] | ||
#[stable(feature = "core_c_void", since = "1.30.0")] | ||
pub enum c_void { | ||
#[unstable( | ||
|
@@ -245,7 +245,7 @@ impl fmt::Debug for c_void { | |
target_os = "uefi", | ||
windows, | ||
))] | ||
#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435 | ||
#[repr(transparent)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
reason = "the `c_variadic` feature has not been properly tested on \ | ||
|
@@ -297,7 +297,7 @@ impl<'f> fmt::Debug for VaListImpl<'f> { | |
not(target_os = "uefi"), | ||
not(windows), | ||
))] | ||
#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401 | ||
#[repr(C)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, |
||
#[derive(Debug)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
|
@@ -317,7 +317,7 @@ pub struct VaListImpl<'f> { | |
|
||
/// PowerPC ABI implementation of a `va_list`. | ||
#[cfg(all(target_arch = "powerpc", not(target_os = "uefi"), not(windows)))] | ||
#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401 | ||
#[repr(C)] | ||
#[derive(Debug)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
|
@@ -337,7 +337,7 @@ pub struct VaListImpl<'f> { | |
|
||
/// s390x ABI implementation of a `va_list`. | ||
#[cfg(target_arch = "s390x")] | ||
#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401 | ||
#[repr(C)] | ||
#[derive(Debug)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
|
@@ -356,7 +356,7 @@ pub struct VaListImpl<'f> { | |
|
||
/// x86_64 ABI implementation of a `va_list`. | ||
#[cfg(all(target_arch = "x86_64", not(target_os = "uefi"), not(windows)))] | ||
#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401 | ||
#[repr(C)] | ||
#[derive(Debug)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
|
@@ -374,7 +374,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)] | ||
#[unstable( | ||
feature = "c_variadic", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this will still show up in the docs, my PR only affects
repr(transparent)
. Further, it doesn't take into account#[doc(hidden)]
(in this case on variants). Arguably, rustdoc should hide#[repr(u8)]
and respectdoc(hidden)
. I can send a PR right away.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we keep non-transparent reprs for enums though? It's useful, especially
repr(c)
ones for FFI.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure, but in this case both variants are
doc(hidden)
. I plan on hiding thoserepr
s if all variants are hidden.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!