[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 Nov 26, 2024
Conversation
Collaborator
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use |
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)
ff801a6 to
5d2b17f
Compare
tamird
reviewed
Nov 26, 2024
| // 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. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport #4151, excluding the last commit that removes the
const-extern-fnfeature.