Uh oh!
There was an error while loading. Please reload this page.
Define c_char using cfg_if rather than repeating 40-line cfg - #91641
Merged
Conversation
rust-highfive
commented
Dec 7, 2021
Contributor
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
Mark-Simulacrum
commented
Dec 7, 2021
Member
@bors r+ rollup |
bors
commented
Dec 7, 2021
Collaborator
📌 Commit db5a2ae has been approved by |
matthiaskrgr added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 8, 2021
Define c_char using cfg_if rather than repeating 40-line cfg Libstd has a 40-line cfg that defines the targets on which `c_char` is unsigned, and then repeats the same cfg with `not(…)` for the targets on which `c_char` is signed. This PR replaces it with a `cfg_if!` in which an `else` takes care of the signed case. I confirmed that `x.py doc library/std` inlines the type alias because c_char_definition is not a publicly accessible path: 
fee1-dead
commented
Dec 8, 2021
Member
Looks like this caused a clippy test to fail in a rollup: #91650 (comment). The stderr now tells users to remove cast to |
dtolnay
commented
Dec 8, 2021
MemberAuthor
I filed rust-lang/rust-clippy#8093 about the false positive and added a workaround in this PR. Tested by: //#[cfg(all())] // unnecessary_cast goes away if uncommentedtypeT = u8;fnmain(){let _ = 0asT;} |
Mark-Simulacrum
commented
Jan 27, 2022
Member
@bors r+ |
bors
commented
Jan 27, 2022
Collaborator
📌 Commit 4e8b91a has been approved by |
bors added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 27, 2022
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#91641 (Define c_char using cfg_if rather than repeating 40-line cfg) - rust-lang#92899 (Mention std::iter::zip in Iterator::zip docs) - rust-lang#93193 (Add test for stable hash uniqueness of adjacent field values) - rust-lang#93325 (Introduce a limit to Levenshtein distance computation) - rust-lang#93339 (rustdoc: add test case for multiple traits and erased names) - rust-lang#93357 (Clarify the `usage-of-qualified-ty` error message.) - rust-lang#93363 (`#[rustc_pass_by_value]` cleanup) - rust-lang#93365 (More arena cleanups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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 freeto 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.
Libstd has a 40-line cfg that defines the targets on which
c_charis unsigned, and then repeats the same cfg withnot(…)for the targets on whichc_charis signed.This PR replaces it with a
cfg_if!in which anelsetakes care of the signed case.I confirmed that
x.py doc library/stdinlines the type alias because c_char_definition is not a publicly accessible path: