Skip to content

fix(kwin): replace unstable atomic_try_update with stable fetch_add - #252

Merged
avifenesh merged 1 commit into
agent-sh:mainfrom
MubarakSec:fix/kwin-stable-atomic
Oct 12, 2026
Merged

avifenesh merged 1 commit into
agent-sh:mainfrom
MubarakSec:fix/kwin-stable-atomic

Conversation

@MubarakSec

Copy link
Copy Markdown
Contributor

Problem

cargo build fails with error[E0658]: use of unstable library feature 'atomic_try_update' at src/windowing/backends/kwin.rs:427.

AtomicU64::try_update is not yet stabilised on stable Rust, so the crate does not compile on any toolchain pinned below its stabilisation — including the rustc shipped by current Ubuntu LTS.

Fix

fetch_add returns the previous value, so checked_add on it reproduces exactly the overflow condition the try_update closure existed to detect. Stable primitives only, no feature gate, no behaviour change on any reachable input.

This was the sole unstable-library usage in the crate.

Testing

Verified on Ubuntu 26.04 / GNOME 50 / Wayland, rustc 1.93.1:

  • cargo build --release — succeeds (previously failed)
  • cargo test --locked --no-fail-fast — 433/433 pass
  • cargo clippy --locked --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • scripts/mcp_safety_check.py — passes

Note on CI visibility

CI pins dtolnay/rust-toolchain@stable, so this is invisible there — it only bites contributors building against distro Rust. Happy to instead add a rust-toolchain.toml, or a CI job against a pinned older toolchain, if that would be preferable to patching the call site.

AtomicU64::try_update is still unstable on stable Rust and is only
usable behind the unstable-library-feature gate, so this crate fails to
build with E0658 on pinned toolchains that predate its stabilisation.

fetch_add returns the previous value; checking it with checked_add
reproduces exactly the overflow condition the try_update closure existed
to detect, using stable primitives only. This is the sole unstable
library usage in the crate.

Verified on Ubuntu 26.04 with rustc 1.93.1: cargo build --release
succeeds and cargo test --lib passes 433/433.
@MubarakSec
MubarakSec requested a review from avifenesh as a code owner October 12, 2026 17:22

@revuto-review revuto-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an auto review done by revuto.


Revuto completed the review and found no evidence-backed concerns.

@avifenesh
avifenesh requested a balanced review from Copilot October 12, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@avifenesh

Copy link
Copy Markdown
Collaborator

Reviewed 341f948 independently. No blocking findings.

Reproduced E0658 on Rust 1.93.1. The proposed atomic code compiles there, and all-target compilation on 1.93.1 passed. Full local tests and formatting passed. CI passed and Revuto approved this head. Copilot hit its quota.

The sequence now starts at 1, and overflow resets the counter. The comment overstates equivalence. Both differences are harmless for this private counter, which starts at zero and is paired with a random nonce. This does not block merging.

Thanks @MubarakSec for the fix and the distro-toolchain validation.

@avifenesh
avifenesh merged commit fd31f81 into agent-sh:main Oct 12, 2026
18 checks passed
@avifenesh avifenesh mentioned this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants