You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust: a weak boolean stored in a local and compared with true (let ok = x > 0; assert_eq!(ok, true)) reads exposed #16296
A test that stores a weak boolean in a local and then compares that local with true through an equality macro reads exposed. The same check written directly reads weak.
Subject: discount(amount) changes if amount > 100 to if amount >= 100, so discount(100) moves from 100 to 90. Each test body below passes on both versions. Probed with ripr check --mode ready on current main plus #16295:
test body
class
let ok = matches!(discount(100), 90 | 100); assert_eq!(ok, true);
exposed
let ok = matches!(discount(100), _); assert_eq!(ok, true);
exposed
let ok = matches!(Some(discount(100)), Some(_)); assert_eq!(ok, true);
exposed
let ok = discount(100) > 0; assert_eq!(ok, true);
exposed
let ok = discount(100) != 95; assert_eq!(ok, true);
exposed
let ok = matches!(discount(100), 90 | 100); assert!(ok);
weakly_exposed
let ok = matches!(discount(100), 90 | 100); assert!(ok == true);
weakly_exposed
let ok = discount(100) == 90 || discount(100) == 100; assert_eq!(ok, true);
The related test reports assert_eq!(ok, true); as exact_value / strong. The assertion line alone has the shape of an exact pin, and the local's defining expression is never read, so a relational, inequality or pattern check stored in a bool counts as an exact pin of the owner's value.
Direction
When an equality assertion compares a test-local boolean with a boolean literal (assert_eq!(ok, true), either operand order, assert_ne!(ok, false)), read the local's single defining expression in the test body. Grade the assertion as RIPR-SPEC-0231 grades that expression written in place: rule 1 for comparisons and disjunctions, rule 3 for matches!. Some cases fail closed and give no exact credit: a local that is reassigned or shadowed, defined in another scope, or whose definition cannot be read.
Acceptance
Each exposed row above reads weakly_exposed. let ok = matches!(discount(100), 90); assert_eq!(ok, true); and let ok = discount(100) == 90; assert_eq!(ok, true); stay exposed.
An end-to-end test through check_workspace, plus an honesty corpus case for the relational row.
A non-boolean local (let v = discount(100); assert_eq!(v, 90);) is unchanged.
Delivered by #16301 (squash 3f546f6). A boolean local that is compared with a boolean literal, and that the function binds exactly once with a plain immutable let, now reads as its initializer written in place. The reading only ever lowers. Both the parser-macro path and the line-scanned path apply it. Cache generation is 1.205 / 0.207.
How this is proven:
unit rows;
an e2e exposed/weakly_exposed pair per shape, including upper-case names;
the honesty-corpus case rust_repo_exposure_bool_local_compared_with_true_not_promoted.
Identifier keys accept any spelling, raw r# included. NFC-equivalent spellings are deliberately left as they are, with reasoning on the PR thread. One related test, operator_call_credit, depended on the old leak. Its body now pins both ordering directions.
Activity
EffortlessSteven commentedon Nov 26, 2026
Claim: this thread takes #16296 after #16295 lands. Both touch the same compared-boolean reading and bump the cache.
claude/project-thread-six0mdGenerated by Claude Code
fix(rust): compared bool locals read through operand comments and the…
test(operator-credit): pin both ordering directions in the derive wit…
merge main; cache generation 1.205 for compared boolean locals (#16296)
EffortlessSteven commentedon Nov 26, 2026
Delivered by #16301 (squash 3f546f6). A boolean local that is compared with a boolean literal, and that the function binds exactly once with a plain immutable
let, now reads as its initializer written in place. The reading only ever lowers. Both the parser-macro path and the line-scanned path apply it. Cache generation is 1.205 / 0.207.How this is proven:
rust_repo_exposure_bool_local_compared_with_true_not_promoted.Identifier keys accept any spelling, raw
r#included. NFC-equivalent spellings are deliberately left as they are, with reasoning on the PR thread. One related test,operator_call_credit, depended on the old leak. Its body now pins both ordering directions.Generated by Claude Code
fix(reveal): read the #12010 sink-level identity on the strength's ex…