transpile: Do not consider Bool an integral type - #2005
Open
Rua wants to merge 1 commit into
Open
Conversation
ahomescu
reviewed
Sep 10, 2026
ahomescu
reviewed
Sep 10, 2026
| matches!(*self, Self::Enum { .. }) | ||
| } | ||
|
|
||
| pub fn is_enum_or_integral_type(&self) -> bool { |
Contributor
There was a problem hiding this comment.
Do we not want true here for bool? Does it regress anything?
Contributor
Author
There was a problem hiding this comment.
This function is only called in CastKind::from_types, where Bool is also handled separately. Possibly the IntegralToPointer case is not, so I've added handling for bool explicitly there now.
Contributor
There was a problem hiding this comment.
You might be introducing some regressions in from_types, can you test bool-to-unsigned casts and maybe bool-to-float? (I'm not sure how much we care about the latter, but it might still be worth to see what happens)
Rua
force-pushed
the
bool-not-integral
branch
from
September 10, 2026 09:03
734cb83 to
c7bae39
Compare
Rua
force-pushed
the
bool-not-integral
branch
from
September 10, 2026 09:05
c7bae39 to
283df6d
Compare
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.
CTypeKind::is_unsigned_integral_typereturnstrueforBool, which is a bit of a footgun and probably not what most code (or coders) expect. So this removes it. I made sure to check that no code elsewhere relies on this includingBooland adjusted it where necessary. Most of the time, it was being used for wrapping arithmetic, which isn't possible on booleans anyway.