-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace handwritten Debug
impls with derives
#4471
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
Merged
Merged
Conversation
This file contains hidden or 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
d9d89d2
to
849a74e
Compare
`s_no_extra_traits!` doesn't derive `Debug` so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions now (printing them like an opaque struct), there really isn't any reason these can't all be derived. Add `derive(Debug)` to `s_no_extra_traits`, still gated behind `feature = "extra_traits"`, which allows getting rid of manual implementations.
849a74e
to
65c39bf
Compare
Verified that the following work: rustc --print target-list | lines | find -v -r '^(aarch64-unknown-teeos|amdgcn-amd-amdhsa|avr-none|hexagon-unknown-none-elf|i686-unknown-hurd-gnu|i686-pc-nto-qnx700|m68k-unknown-.*|riscv64gc-unknown-netbsd|x86_64-lynx-lynxos178|x86_64-unknown-hurd-gnu|x86_64-unknown-linux-none|xtensa-esp32.*)$' | each { |$tgt| print $tgt; cargo c -p libc --target $tgt -Zbuild-std=core; cargo c -p libc --target $tgt --features extra_traits -Zbuild-std=core }
rustc --print target-list | lines | find freebsd | each { |tgt| for version in [11, 12, 13, 14, 15] { print $"($tgt) freebsd($version)"; RUST_LIBC_UNSTABLE_FREEBSD_VERSION=$version cargo c -p libc --target $tgt -Zbuild-std=core; RUST_LIBC_UNSTABLE_FREEBSD_VERSION=$version cargo c -p libc --target $tgt --features extra_traits -Zbuild-std=core } } All of the skipped targets are failed on |
tgross35
added a commit
to tgross35/rust-libc
that referenced
this pull request
Jun 3, 2025
`s_no_extra_traits!` doesn't derive `Debug` so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions now (printing them like an opaque struct), there really isn't any reason these can't all be derived. Add `derive(Debug)` to `s_no_extra_traits`, still gated behind `feature = "extra_traits"`, which allows getting rid of manual implementations. (backport <rust-lang#4471>) (cherry picked from commit 65c39bf)
Merged
tgross35
added a commit
to tgross35/rust-libc
that referenced
this pull request
Jun 3, 2025
`s_no_extra_traits!` doesn't derive `Debug` so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions now (printing them like an opaque struct), there really isn't any reason these can't all be derived. Add `derive(Debug)` to `s_no_extra_traits`, still gated behind `feature = "extra_traits"`, which allows getting rid of manual implementations. (backport <rust-lang#4471>) (cherry picked from commit 65c39bf)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
O-android
O-arm
O-bsd
O-dragonfly
O-gnu
O-illumos
O-linux
O-linux-like
O-macos
O-musl
O-redox
O-riscv
O-solarish
O-unix
O-x86
S-waiting-on-review
stable-applied
This PR has been cherry-picked to libc's stable release branch
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.
s_no_extra_traits!
doesn't deriveDebug
so there are a lot of handwritten implementations. However, since we have a derive-like solution for unions now (printing them like an opaque struct), there really isn't any reason these can't all be derived.Add
derive(Debug)
tos_no_extra_traits
, still gated behindfeature = "extra_traits"
, which allows getting rid of manual implementations.