Repository navigation
fix(rust): reveal side does not read an interior-mutable let or static mut as its initializer (#8112) - #8533
Conversation
…c mut as its initializer (#8112) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0193fZVBGjXWpxEYFUzBGCYt
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 29 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
- declares_static_mut scans the entire masked source for any 'static' token then walks forward to check 'mut name'; O(file_length) per expected name. Acceptable since classify is invoked once per test summary, but worth noting if the file ever grows very large.
- PR changelog claims the reveal-side bug is fixed for both interior-mutable let and static mut, but the changelog entry and the diff omit any mention that allowlist scope is closed (e.g. user-defined
UnsafeCell<X>wrappers,parking_lot::Mutex,tokio::sync::Mutex). A reader cannot tell whether the allowlist is intentional or temporary. - Lane ub-active-view (resizable buffer / ArrayBuffer / TypedArray resize-detach-transfer / stale length) is out of scope for this Rust-only source-classifier PR; no JS, WASM memory, or buffer abstraction is touched by the diff. Active-view invariants cannot be violated by string-slicing over masked source.
Verification questions
- Confirm body method
let e = std::rc::Rc::new(RefCell::new(weight(2))); assert_eq!(weight(2), e);compares weight(2) (i64-like) against Rc<RefCell<...>>. Equality almost certainly fails at runtime; this is a reach-only structural refusal test, not value-equivalent. Acceptable as oracle since it asserts None from value() regardless of runtime type, but readers may mistake it for a runnable example. - Confirm test row for
Rc<RefCell>does not actually mutateebefore the assertion; without a.borrow_mut()write, the refusal still holds trivially and does not exercise the would-be bypass. - Confirm
has_interior_mutabilityuses whole-word substring match on the masked initializer, soAtomic * weight(2)-style expressions and user-defined wrappers (e.g.Counter(Cell::new(...))) are not detected, leaving a same-class bypass. - Confirm tests are the legitimate refusal rows called out in PR body (Cell, Rc, static mut). ToC spans diff hunks at owner_pin.rs ~9308-9369 and tests.rs ~2531. Underlying heuristic is name-list matching (contains_as_whole_word) and
static mutparser, not a typed interior-mutability analysis. - Confirm block-scope gap from #8112 explicitly out-of-scope per PR body; 'interior mutable static' (e.g.
static CELL: Cell<u32> = Cell::new(0)) is also not addressed by this diff.
Refuted
- A
static mut Edeclaration in the same file aspub static EXPECTEDcould be mis-detected as the in-scope target and incorrectly trigger refusal ofEXPECTED.; refuted because: declares_static_mut requiresstatic mut <name>where<name>is the operand looked up, so a genericstatic mut Edoes not match the bindingEXPECTED. False premise.
Evidence gaps
- Issue thread says
cargo xtask precommitand lib tests were not run locally due to container OOM; hosted CI receipt is the real proof. - AST-grep + diff show only immutable_let_value and single_constant_value changed; ripr binary failed (exit 2) but is downstream consumer, not invoked by these classify helpers.
- Model proof intent was rejected by deterministic validation.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0193fZVBGjXWpxEYFUzBGCYt
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Requested by Steven · project thread
Before:
expected_operand_valuefollowed an immutableletofCell/RefCell/Mutex/atomic type, or astatic mut, to its initializer. The reveal side then wrongly weakened an assertion that compares against a value the test had since changed.After: both are refused (
immutable_let_valuerejects interior-mutable initializers;single_constant_valuerejects a constant declaredstatic mut). Plain immutableletandconst/statickeep their existing behavior. Block-scope gap from the issue is not addressed here.Proof:
cargo check -p ripr --libpasses. New refusal rows added tothe_reveal_side_reads_an_expected_name_only_through_one_readable_let_or_constant(Cell, Rc, static mut, Mutex, AtomicUsize); existing positives in that test are the controls. NOT run locally: the lib test target OOM-kills rustc in this shared container, socargo xtask precommitand the unit test need hosted CI before merge.Closes part of #8112 (interior-mutable let and static mut; block scope remains).
Source-of-truth Links
Governing issue or accepted claim: #8112
Acceptance delta (one sentence): The reveal side no longer follows an interior-mutable
letor astatic mutto its initializer as the expected value.Generated by Claude Code