Define c_char using cfg_if rather than repeating 40-line cfg#91641
Merged
bors merged 2 commits intorust-lang:masterfrom Jan 28, 2022
Merged
Define c_char using cfg_if rather than repeating 40-line cfg#91641bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Contributor
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
Member
|
@bors r+ rollup |
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: 
Member
|
Looks like this caused a clippy test to fail in a rollup: #91650 (comment). The stderr now tells users to remove cast to |
Member
Author
|
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 uncommented
type T = u8;
fn main() {
let _ = 0 as T;
} |
Member
|
@bors r+ |
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 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.
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: