From 7c057003a448c29693451818748bf19984302237 Mon Sep 17 00:00:00 2001 From: Fernando Chorney Date: Fri, 10 Jul 2026 10:17:35 -0500 Subject: [PATCH] fix(build): repair the macOS build main does not compile on macOS with stable Rust. Both faults are inside macOS-only cfg blocks, so CI on other targets stays green. 1. deadlib-renderer window_size.rs: macos_opengl_low_dpi is a const fn that compares BackendType with ==, which calls PartialEq::eq. That is not callable in a const fn on stable (it needs const_trait_impl), so the crate fails with E0015. Use matches! instead: pattern matching needs no trait call, and the function stays const. 2. deadsync-shell window.rs: the with_disallow_hidpi call arrived here without its trait. WindowAttributesExtMacOS is in scope in window_size.rs, where the call used to live, but not in window.rs, so the crate fails with E0599. Import the trait, cfg-gated like the call site. Also drop WindowAttributesExtMacOS from window_size.rs, which no longer uses it now that the call moved: on macOS it was an unused import. No behaviour change on any target. --- crates/deadlib-renderer/src/window_size.rs | 6 ++++-- crates/deadsync-shell/src/window.rs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/deadlib-renderer/src/window_size.rs b/crates/deadlib-renderer/src/window_size.rs index de889b06..f0180658 100644 --- a/crates/deadlib-renderer/src/window_size.rs +++ b/crates/deadlib-renderer/src/window_size.rs @@ -5,12 +5,14 @@ use winit::{ }; #[cfg(target_os = "macos")] -use winit::{dpi::LogicalSize, platform::macos::WindowAttributesExtMacOS}; +use winit::dpi::LogicalSize; #[cfg(target_os = "macos")] #[inline(always)] const fn macos_opengl_low_dpi(backend_type: BackendType, high_dpi: bool) -> bool { - backend_type == BackendType::OpenGL && !high_dpi + // `matches!` rather than `==`: `PartialEq::eq` is not callable in a `const fn` + // on stable, but pattern matching is. + matches!(backend_type, BackendType::OpenGL) && !high_dpi } #[cfg(not(target_os = "macos"))] diff --git a/crates/deadsync-shell/src/window.rs b/crates/deadsync-shell/src/window.rs index feece062..d0503a07 100644 --- a/crates/deadsync-shell/src/window.rs +++ b/crates/deadsync-shell/src/window.rs @@ -9,6 +9,8 @@ use deadlib_renderer::{render_size_for_window, request_window_size, with_request use deadsync_config::app_config::DisplayMode; use winit::dpi::{PhysicalPosition, PhysicalSize}; use winit::event_loop::ActiveEventLoop; +#[cfg(target_os = "macos")] +use winit::platform::macos::WindowAttributesExtMacOS; use winit::window::{Icon, Window}; const WINDOW_ICON_PATHS: [&str; 2] = [