opc-gui: suffix Stroke::new width literals as f32 (unblocks the release) - #31
Conversation
The v0.2.0-alpha.21 release build failed on the macOS x86_64 job — and
only that job — after every other platform had succeeded:
error: falling back to `f32` as the trait bound `f32: From<f64>`
is not satisfied
--> src/theme.rs:30:60
|
30 | ...fg_stroke = Stroke::new(1.0, TEXT_SECONDARY);
| ^^^ help: explicitly specify
| the type as `f32`: `1.0_f32`
= note: `-D float-literal-f32-fallback` implied by `-D warnings`
error: could not compile `opc-gui` due to 11 previous errors
`egui::Stroke::new` takes `width: impl Into<f32>`. An unsuffixed `1.0`
is `{float}`, and since `f64: Into<f32>` does not exist, rustc falls
back to `f32` — behaviour that `float_literal_f32_fallback` (rust-lang/
rust#154024) is phasing out and that will become a hard error. The
suffix is what was always meant; it cannot change behaviour.
Why only one job: the two macOS runners disagree on rustc.
`macos arm64` had 1.96.0 (2026-05-25), which predates the lint;
`macos x86_64` had 1.97.1 (2026-07-14), which has it. Same workflow,
same `rust-toolchain.toml`, different preinstalled toolchain — worth
knowing, because it means the release builds are not reproducible
across runners today.
Reproduced locally on rustc 1.98.0 with a minimal case matching
`Stroke::new`'s signature: the unsuffixed literal errors under
`-D warnings`, the `_f32` form is silent.
Also stops the release workflow denying on warnings.
`actions-rust-lang/setup-rust-toolchain` defaults `RUSTFLAGS` to
`-D warnings`; release.yml never asked for that, it just inherited it.
That policy belongs in CI, which gates every PR — applying it to a
release build means any lint a runner picks up from a newer rustc can
block shipping after every artifact has already built, which is
exactly what happened here. `rustflags: ""` on the four release jobs;
ci.yml keeps `-D warnings` on clippy and rustdoc, so nothing is
relaxed about what actually gates a change.
Note for a follow-up: none of this was caught before the release
because `bins/opc-gui` is outside the workspace and CI never builds
it — `cargo build --workspace` does not reach it, and the GUI is
compiled for the first time during a release. A CI job running
`cargo build --manifest-path bins/opc-gui/Cargo.toml --locked` would
have turned this into a red PR instead of a failed release.
|
Correcting one thing I wrote in the description above, before it gets acted on. I said a CI job could build That is consistent with the release artifacts, which ship the GUI for macOS and Windows only. So no amount of apt packages makes a Linux GUI job work; it would need eframe's The cheap option that would actually have caught this lint is a cross-target check from the existing ubuntu runner, no new runner minutes: - run: rustup target add x86_64-pc-windows-msvc
- run: cargo check --manifest-path bins/opc-gui/Cargo.toml --target x86_64-pc-windows-msvc --locked
Either way it stays out of this PR, which exists to unblock the release. |
The
v0.2.0-alpha.21release build failed on macOS x86_64 only, after Linux x86_64, Linux aarch64 and macOS arm64 had all succeeded.create-releasetherefore never ran and no release was published.Why
egui::Stroke::newtakeswidth: impl Into<f32>. An unsuffixed1.0is{float}, and sincef64: Into<f32>does not exist, rustc falls back tof32— the behaviour rust-lang/rust#154024 is phasing out. The suffix is what was always meant; it cannot change behaviour. 11 sites, allStroke::new(1.0, …).Why only one job
The two macOS runners disagree on rustc:
Same workflow, same
rust-toolchain.toml(channel = "stable"), different preinstalled toolchain — and neither is current stable (1.98.0). Worth knowing separately: release builds are not reproducible across runners today.Second change: release builds no longer deny on warnings
actions-rust-lang/setup-rust-toolchaindefaultsRUSTFLAGSto-D warnings.release.ymlnever asked for that — there is norustflags:key anywhere in it — it just inherited the default. That policy belongs in CI, which gates every PR. Applying it to a release build means any lint a runner happens to pick up from a newer rustc can block shipping after every artifact has already compiled, which is precisely what happened here.rustflags: ""on the four release jobs.ci.ymlkeeps-D warningson clippy andRUSTDOCFLAGS, so nothing that actually gates a change is relaxed.Verification
Reproduced locally on rustc 1.98.0 (newer than the failing runner's 1.97.1) with a minimal case matching
Stroke::new's signature — unsuffixed literal errors under-D warnings,_f32form is silent:Workspace unaffected and still green:
cargo test --workspace --locked→ 291 passed,cargo fmt --all --check→ clean,cargo clippy --workspace --all-targets -- -D warnings→ clean.release.ymlparses.Every changed line is 52–84 chars, well inside rustfmt's 100, so this adds no formatting drift.
Follow-up worth doing (not in this PR)
CI never builds
opc-gui. It lives outside the workspace with its ownCargo.lock, socargo build --workspacedoes not reach it andcargo fmt --all -- --checkdoes not format-check it. The GUI is compiled for the first time during a release, which is why an 11-error compile failure only surfaced at tag time. Addingto
ci.yml(with the GTK deps the Linux runner needs) would have made this a red PR instead of a failed release. Related:bins/opc-gui/src/views.rscurrently has 21 rustfmt diffs onmainfor the same reason — deliberately not touched here, since a whole-file reformat has no place in a PR unblocking a release.