Skip to content

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Sep 23, 2025

@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2025

Some changes occurred in OpenBSD module

cc @semarie

Some changes occurred in OpenBSD module

cc @semarie

Some changes occurred in solarish module

cc @jclulow, @pfmooney

Some changes occurred in the Android module

cc @maurer

@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2025

⚠️ Warning ⚠️

  • Pull requests are usually filed against the main branch for this repo, but this one is against libc-0.2. Please double check that you specified the right target!

@tgross35 tgross35 force-pushed the backport-green-beans branch 2 times, most recently from 70a664d to ab7a5ca Compare September 23, 2025 09:10
Partial cherry pick of 192bccb ("ctest: add suport for c enum").
Currently `Debug` implementations are gated behind the `extra-traits`
feature. My understanding is that historically, this was for two
reasons:

1. `Debug` implementations for unions were unsound
2. Concerns about compile time

The first was resolved a while ago by adding a "manual derive" opaque
implementation, in 6faa521 ("fix: make Debug impl for unions
opaque"). Regarding the second reason, compile times for the current
`main` on my machine are (cleaning in between, with the 2025-08-06
nightly):

    $ cargo build -p libc
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.79s
    $ cargo build -p libc --release
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `release` profile [optimized] target(s) in 0.64s
    $ cargo build -p libc --features extra_traits
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.08s
    $ cargo build -p libc --features extra_traits --release
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `release` profile [optimized] target(s) in 0.85s

And with this patch applied:

    $ cargo build -p libc
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.89s
    $ cargo build -p libc --release
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `release` profile [optimized] target(s) in 0.70s
    $ cargo build -p libc --features extra_traits
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.15s
    $ cargo build -p libc --features extra_traits --release
     Compiling libc v1.0.0-alpha.1 (~/rust-libc)
      Finished `release` profile [optimized] target(s) in 0.86s

That is a microbenchmark but it shows that there probably isn't anything
to worry about.

Thus, remove the `Debug` implementation from the `feature =
"extra_traitts"` gating.

Another advantage of doing this is that it should allow many crates to
remove the enable for `extra_traits`, giving us a better idea of who
wants `Debug` vs. who is actually using the `Eq`/`Hash` implementations.

Link: rust-lang#3880

(backport <rust-lang#4624>)
(cherry picked from commit a6e7563)
[ needed to apply in a few more places, including the e! macro
  definition - Trevor ]
Use the `MaybeUninit` formatting so this prints as `Padding<u32>` or
similar.

(backport <rust-lang#4711>)
(cherry picked from commit 4c95aea)
This originally existed for MSRV support, then became a necessary hack
to support the old ctest's inability to parse `const fn`. The new ctest
doesn't have this limitation, so remove the config.

Additionally, switch from the `*` kleene to `?` since that is possible
now.

(backport <rust-lang#4712>)
(cherry picked from commit 4894081)
This was a workaround for the old ctest not being able to parse
something related to the `addr_of!` macros in statics referencing
statics. This is not needed with the new ctest; thus, remove the config.

(backport <rust-lang#4713>)
(cherry picked from commit 4f2c41a)
(backport <rust-lang#4713>)
(cherry picked from commit 6f0ebb8)
[ note that there was no FIXME comment on 0.2 - Trevor ]
The old ctest couldn't handle `target_vendor`, but this is no longer an
issue. Simplify the config here.

(backport <rust-lang#4713>)
(cherry picked from commit 94e3f98)
We no longer need to support gating `const` behind
`libc_const_extern_fn`, so remove the awkward `{const}` syntax.

(backport <rust-lang#4714>)
(cherry picked from commit e860257)
Now that is okay for functions to be always `const`, this macro doesn't
add anything other than the `#[inline]` attribute, which isn't useful
for private functions anyway. Thus, remove the macro and leave its
contents wherever it is used.

(backport <rust-lang#4714>)
(cherry picked from commit dcde5cd)
This was removed by accident; only the `feature = "rustc-dep-of-std"`
gate should have been removed.

Fixes: a6e7563 ("Always implement `Debug`")

(backport <rust-lang#4715>)
(cherry picked from commit 833eb19)
@tgross35 tgross35 force-pushed the backport-green-beans branch from 7685d9c to d5584cd Compare September 23, 2025 09:17
@tgross35 tgross35 enabled auto-merge September 23, 2025 09:20
@tgross35 tgross35 added this pull request to the merge queue Sep 23, 2025
Merged via the queue into rust-lang:libc-0.2 with commit 6ca5571 Sep 23, 2025
50 checks passed
@tgross35 tgross35 deleted the backport-green-beans branch September 23, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants