From 5ce5c0db829d97c29e6fb81d622b711c28e74b5d Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 06:00:40 +0300 Subject: [PATCH] Rust 1.95: rust-toolchain.toml, the workspace rust-version and the gateway image; the lints 1.95 adds gpui-kit (every gpui-pre 0.3.x) calls std::hint::cold_path, stable since 1.95.0, so the client moves from 1.94 to 1.95 before the GPUI front end can build (docs/design/gpui-spikes.md, "Rust 1.95 or newer"). rustc 1.95.0 (59807616e 2026-04-14), cargo 1.95.0, clippy and rustfmt of the same release were used. rust-toolchain.toml and the workspace's rust-version say 1.95; crates/voelin-gateway/Dockerfile builds from rust:1.95-bookworm (cargo refuses a 1.94 image once rust-version is 1.95). docs/building.md names the Rust version for a local build; docs/ci.md says a channel change in rust-toolchain.toml is all the runner needs (they named no version before). Clippy of 1.95 adds `collapsible_match` for an `if` that is a match arm's only statement, `unnecessary_sort_by` and `manual_checked_ops`; they flagged seven spots in four crates, none a behaviour change: - voelin-media capture::forward: a let-else instead of a match whose arm holds one `if`; - voelin-media ffmpeg::sys: `sort_by_key` with `Reverse` (two places); - voelin-media studio::camera: `checked_div` for the frame interval; - voelin-stream peer and session: the condition in a local before the `if` (a guard would carry a side effect: `remove`); - voelinctl engine and session: the same. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- crates/voelin-gateway/Dockerfile | 2 +- crates/voelin-media/src/capture/mod.rs | 14 +++++++------- crates/voelin-media/src/ffmpeg/sys.rs | 4 ++-- crates/voelin-media/src/studio/camera.rs | 4 ++-- crates/voelin-stream/src/peer.rs | 3 ++- crates/voelin-stream/src/session.rs | 3 ++- docs/building.md | 5 +++++ docs/ci.md | 6 +++--- rust-toolchain.toml | 2 +- tools/voelinctl/src/engine.rs | 3 ++- tools/voelinctl/src/session.rs | 3 ++- 13 files changed, 35 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ac674..db51f66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,11 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows ### Changed +- The build needs Rust 1.95 (`rust-toolchain.toml` and the workspace's + `rust-version`; 1.95.0 was used to check it), up from 1.94: the GPUI + front end, which is being built, depends on a library that calls a function + stable since 1.95. Nothing changes in the apps; the gateway's Docker image + builds from `rust:1.95-bookworm`. - The key store now keeps the device key when signing out of an account, unbound, whether it was in use before the account or was made for it; "Forget this device's identity" is the only way a key is deleted. The identity store diff --git a/Cargo.toml b/Cargo.toml index 61c3b6f..1be3de8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ default-members = [ [workspace.package] edition = "2024" -rust-version = "1.94" +rust-version = "1.95" license = "MIT OR Apache-2.0" repository = "https://github.com/Faumaray/Voelin" publish = false diff --git a/crates/voelin-gateway/Dockerfile b/crates/voelin-gateway/Dockerfile index e6ad157..cbd6f35 100644 --- a/crates/voelin-gateway/Dockerfile +++ b/crates/voelin-gateway/Dockerfile @@ -9,7 +9,7 @@ # -e TSGW_QUERY_PASSWORD=… -p 7788:7788 tsgw # Logs: docker logs -f tsgw (more: -e TSGW_LOG_LEVEL=debug; also to a file in # the volume: -e TSGW_LOG_FILE=logs/tsgw.log). See docs/gateway-admin.md. -FROM rust:1.94-bookworm AS build +FROM rust:1.95-bookworm AS build WORKDIR /src RUN apt-get update && apt-get install -y --no-install-recommends cmake git libasound2-dev openssh-client && rm -rf /var/lib/apt/lists/* # voelin-identity comes from the private VoelinProtocol repository, fetched diff --git a/crates/voelin-media/src/capture/mod.rs b/crates/voelin-media/src/capture/mod.rs index f0568d9..d2b91bb 100644 --- a/crates/voelin-media/src/capture/mod.rs +++ b/crates/voelin-media/src/capture/mod.rs @@ -279,14 +279,14 @@ impl FrameSink for QueueSink { pub fn forward(mut frames: FrameReceiver, mut sink: Box) -> Result<()> { std::thread::Builder::new().name("voelin-capture-forward".into()).spawn(move || { loop { - match frames.recv_timeout(Duration::from_millis(100)) { - Some(frame) => { - if sink.wants(frame.timestamp) && !sink.frame(frame.view()) { - break; - } + let Some(frame) = frames.recv_timeout(Duration::from_millis(100)) else { + if frames.is_closed() { + break; } - None if frames.is_closed() => break, - None => {} + continue; + }; + if sink.wants(frame.timestamp) && !sink.frame(frame.view()) { + break; } } })?; diff --git a/crates/voelin-media/src/ffmpeg/sys.rs b/crates/voelin-media/src/ffmpeg/sys.rs index f72635d..a6bf3bd 100644 --- a/crates/voelin-media/src/ffmpeg/sys.rs +++ b/crates/voelin-media/src/ffmpeg/sys.rs @@ -446,7 +446,7 @@ fn files_in(dir: &Path, base: &str) -> Vec { matches.then(|| (major_of(&name).unwrap_or(0), e.path())) }) .collect(); - found.sort_by(|a, b| b.0.cmp(&a.0)); + found.sort_by_key(|entry| std::cmp::Reverse(entry.0)); found.into_iter().map(|(_, p)| p).collect() } @@ -466,7 +466,7 @@ fn ldconfig(base: &str) -> Vec { name.starts_with(&prefix).then(|| (major_of(name).unwrap_or(0), PathBuf::from(path))) }) .collect(); - found.sort_by(|a, b| b.0.cmp(&a.0)); + found.sort_by_key(|entry| std::cmp::Reverse(entry.0)); found.into_iter().map(|(_, p)| p).collect() } diff --git a/crates/voelin-media/src/studio/camera.rs b/crates/voelin-media/src/studio/camera.rs index 298c967..fbbe8d0 100644 --- a/crates/voelin-media/src/studio/camera.rs +++ b/crates/voelin-media/src/studio/camera.rs @@ -603,8 +603,8 @@ mod v4l2 { // Seconds per frame; a stepwise range starts with its smallest // interval, which is the highest rate. let (num, den) = (entry.interval[0], entry.interval[1]); - if num > 0 { - best = best.max(den / num); + if let Some(rate) = den.checked_div(num) { + best = best.max(rate); } if entry.type_ != FRMIVAL_DISCRETE { break; diff --git a/crates/voelin-stream/src/peer.rs b/crates/voelin-stream/src/peer.rs index 9777f5b..71b10df 100644 --- a/crates/voelin-stream/src/peer.rs +++ b/crates/voelin-stream/src/peer.rs @@ -1075,7 +1075,8 @@ impl Task { } Event::IceConnectionStateChange(IceConnectionState::Disconnected) => return false, Event::MediaAdded(m) => { - if !self.mids.iter().any(|(mid, _)| *mid == m.mid) { + let known = self.mids.iter().any(|(mid, _)| *mid == m.mid); + if !known { self.mids.push((m.mid, m.kind)); } } diff --git a/crates/voelin-stream/src/session.rs b/crates/voelin-stream/src/session.rs index 694624d..9899dc1 100644 --- a/crates/voelin-stream/src/session.rs +++ b/crates/voelin-stream/src/session.rs @@ -801,7 +801,8 @@ impl StreamerSession { } StreamNotification::JoinRequest { viewer, remove: true, .. } | StreamNotification::ViewerLeft { viewer, .. } => { - if self.viewers.remove(&viewer.0).is_some() { + let was_viewer = self.viewers.remove(&viewer.0).is_some(); + if was_viewer { self.emit_viewers(out); self.update_targets(out); } diff --git a/docs/building.md b/docs/building.md index d6cb80c..b1d1276 100644 --- a/docs/building.md +++ b/docs/building.md @@ -119,6 +119,11 @@ the proxy is on localhost. If the proxy inspects TLS, set ## Locally without Docker +- **Rust:** 1.95, the channel `rust-toolchain.toml` pins; `rustup` installs it + on the first `cargo` run in the checkout. The workspace's `rust-version` is + 1.95 too, the oldest Rust the GPUI front end's libraries build with (they + call `std::hint::cold_path`, stable since 1.95.0), so a distribution's older + `rustc` does not build the workspace. - **Linux:** the packages from the table above need `sudo apt install libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev cmake dpkg-dev patchelf`, then `cargo build --release --locked -p voelin-ui -p voelin-gateway` diff --git a/docs/ci.md b/docs/ci.md index d388927..f9ad8c2 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -89,9 +89,9 @@ the separate `release.yml` workflow below. The workflow shares the repository's local system-dependencies action with GitHub CI and bootstraps rustup if absent, then installs the toolchain and -components pinned in `rust-toolchain.toml`. Checkout uses a fully qualified -GitHub action URL rather than depending on the instance's action-source -configuration. +components pinned in `rust-toolchain.toml` (1.95: a channel change there is all +the runner needs). Checkout uses a fully qualified GitHub action URL rather +than depending on the instance's action-source configuration. No GitHub cache/artifact service or reusable-workflow support is required. The job does not need a Docker socket mounted inside its container; the diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 082d590..a7795bb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.94" +channel = "1.95" components = ["rustfmt", "clippy"] diff --git a/tools/voelinctl/src/engine.rs b/tools/voelinctl/src/engine.rs index d2d20fe..ff483a4 100644 --- a/tools/voelinctl/src/engine.rs +++ b/tools/voelinctl/src/engine.rs @@ -434,7 +434,8 @@ impl Roundtrip { GatewayUpdate::Reaction { message_id, added: true, .. } if self.step == Step::React && *message_id == self.remote => { - if self.reacted_row { + let reacted = self.reacted_row; + if reacted { self.next(engine, Step::Topic); } } diff --git a/tools/voelinctl/src/session.rs b/tools/voelinctl/src/session.rs index 6b627f4..fe346af 100644 --- a/tools/voelinctl/src/session.rs +++ b/tools/voelinctl/src/session.rs @@ -324,7 +324,8 @@ async fn listen( let end = pump(con, deadline, |con, item| { match item { StreamItem::BookEvents(events) => { - if print_events(con.get_state()?, &events, json, expect)? { + let done = print_events(con.get_state()?, &events, json, expect)?; + if done { return Ok(Flow::Stop); } }