Issue #2122: arithmetic on a std type is refused by no check and reaches rustc: `use…

Open and answer this issue on GitHub.

decision, bugs · opened 2026-11-18 · updated 2026-11-18 · 0 comments

Filed by the driver from the Found: of the run of issue-2117 (#2117) (owner, 2026-11-06).

Found

arithmetic on a std type is refused by no check and reaches rustc: use std::time\nfn main() throws {\n let a = time::now()\n let b = a + 1\n println(f"{b == a}")\n} gives NK1343 “Rustc output: mismatched types” (the same for thread::id() + 1, rustc Id does not implement Add<{integer}>); it should be NK1191, as P { x: 1 } + 1 on a program’s own struct is (“You can’t use + on a P”). Traced: declared_with_no_arithmetic (check_items.nika) looks only at the file’s own struct and enum items, and std.contracts has no key that says which std types have operators (Part I writes self * 2 on a time::Duration, the simd vectors have bit operators), so a fail-closed rule needs a new contracts key; no decision yet

To build

Done when

The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the probe already passes on develop and a test pins it, naming the commit that fixed it; or the issue is closed as by design, naming the function or ADR.


Generated by Claude Code

Back to Open Issues