Skip to content

[0.2]: Ensure all tests in the workspace are run and that const extern fn is always enabled#4152

Merged
tgross35 merged 2 commits intorust-lang:libc-0.2from
tgross35:backport-tests-and-const-extern
Nov 26, 2024
Merged

[0.2]: Ensure all tests in the workspace are run and that const extern fn is always enabled#4152
tgross35 merged 2 commits intorust-lang:libc-0.2from
tgross35:backport-tests-and-const-extern

Conversation

@tgross35
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 commented Nov 26, 2024

Backport #4151, excluding the last commit that removes the const-extern-fn feature.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Nov 26, 2024

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Specifically, this should ensure that unit tests in the `libc` crate
don't get missed.

(backport <rust-lang#4151>)
(cherry picked from commit f553033)
In [1] this conditional was dropped in favor of a Cargo feature, which
was turned on by default in [2]. However, this did not help the case
where `--no-default-features` is passed.

Unfortunately we still can't drop this config entirely since `ctest`
cannot parse the syntax, so change back to useing a `cfg` to control
constness rather than a Cargo feature.

Additionally, remove a portion of the macro's comment that is no longer
relevant.

Fixes: rust-lang#4149

[1]: rust-lang#4105
[2]: rust-lang#4134

(backport <rust-lang#4151>)
(cherry picked from commit e18ee8c)
// Specifically, moving the 'cfg_if' into the macro body will *not* work. Doing so would cause the
// '#[cfg(libc_const_extern_fn)]' to be emitted into user code. The 'cfg' gate will not stop Rust
// from trying to parse the 'pub const unsafe extern fn', so users would get a compiler error even
// when the 'libc_const_extern_fn' feature is disabled.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's no longer a feature.

@tgross35 tgross35 added this pull request to the merge queue Nov 26, 2024
Merged via the queue into rust-lang:libc-0.2 with commit 4843c55 Nov 26, 2024
@tgross35 tgross35 deleted the backport-tests-and-const-extern branch November 26, 2024 22:14
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.

4 participants