Consider Scalar to be a bool only if its unsigned#80562
Merged
bors merged 1 commit intorust-lang:masterfrom Jan 30, 2021
Merged
Consider Scalar to be a bool only if its unsigned#80562bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @varkor (rust-highfive has picked a reviewer for you, use r? to override) |
Member
Author
|
An alternative fix could be to set |
Contributor
|
r? @eddyb, who is more familiar with the subtleties here. There already seems to be special casing regarding boolean values for signed integers, e.g. rust/compiler/rustc_codegen_ssa/src/mir/place.rs Lines 241 to 248 in 1d27267 which would presumably become vacuous if signed integers are never treated as booleans. |
camelid
reviewed
Jan 22, 2021
eddyb
approved these changes
Jan 29, 2021
Member
|
Sorry for the delay, r=me with @camelid's suggestion applied. |
This seems right, given that conceptually bools are unsigned, but the implications of this change may have more action at distance that I'm not sure how to exhaustively consider. For instance there are a number of cases where code attaches range metadata if `scalar.is_bool()` holds. Supposedly it would no longer be attached to the `repr(i8)` enums? Though I'm not sure why booleans are being special-cased here in the first place... Fixes rust-lang#80556
bf7aa55 to
915a04e
Compare
Member
Author
|
@bors r=eddyb |
Collaborator
|
📌 Commit 915a04e has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 30, 2021
Rollup of 16 pull requests Successful merges: - rust-lang#79023 (Add `core::stream::Stream`) - rust-lang#80562 (Consider Scalar to be a bool only if its unsigned) - rust-lang#80886 (Stabilize raw ref macros) - rust-lang#80959 (Stabilize `unsigned_abs`) - rust-lang#81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`) - rust-lang#81409 (Slight simplification of chars().count()) - rust-lang#81468 (cfg(version): treat nightlies as complete) - rust-lang#81473 (Warn write-only fields) - rust-lang#81495 (rustdoc: Remove unnecessary optional) - rust-lang#81499 (Updated Vec::splice documentation) - rust-lang#81501 (update rustfmt to v1.4.34) - rust-lang#81505 (`fn cold_path` doesn't need to be pub) - rust-lang#81512 (Add missing variants in match binding) - rust-lang#81515 (Fix typo in pat.rs) - rust-lang#81519 (Don't print error output from rustup when detecting default build triple) - rust-lang#81520 (Don't clone LLVM submodule when download-ci-llvm is set) 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.
This seems right, given that conceptually bools are unsigned, but the
implications of this change may have more action at distance that I'm
not sure how to exhaustively consider.
For instance there are a number of cases where code attaches range
metadata if
scalar.is_bool()holds. Supposedly it would no longer beattached to the
repr(i8)enums? Though I'm not sure why booleans arebeing special-cased here in the first place...
Fixes #80556
cc @eddyb