Repository navigation
audit:resolution: a checked narrowing is the operand's type (part of #3423) - #3424
Merged
Merged
Conversation
…type. A shift count narrows to u32 with a range check (D183); the lowering applied it and then recorded the narrowed operand against the expression's own type, so every such shift read as 'an expression lowered to an operand of another type': 36 false violations on the compiler's own source
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.
A shift count narrows to
u32with a range check that Sema records on the count's expression (D183). The lowering applied the narrowing and then recorded the narrowed operand against the expression's own type, soaudit:resolutionreported "an expression lowered to an operand of another type (MIR u32, Sema i32)" for every such shift: 36 false violations on the compiler's own source. The record now takes the narrowing Sema recorded, as it already does for the Option, splat and lane-conversion adjustments.Test:
behav_audit_checked_narrowing_operandruns a shift program andaudit:resolutionon it (fails before, passes after).Part of #3423:
audit:allonsrc/main.wgoes from 76 violations to 40.Battery green on the branch tip;
:release-checksgreen.