From 3698a67bb7cce3eb8d26a62c4c208499ab5b1d3d Mon Sep 17 00:00:00 2001 From: David Mann Date: Fri, 27 Nov 2026 14:27:56 +0100 Subject: [PATCH] CI: fix the doc, 1.70.0 and Windows test failures on craft/0.30.13 With the lockfile step fixed, CI reaches steps that were never green on this branch: - rustdoc -D warnings: escape `*` inside (invalid_html_tags) and wrap a bare URL in dark_mode.rs (nightly's bare_urls). - docs.rs check (nightly, every platform): platform::wayland is built under docsrs on all platforms, but its clipboard API names platform_impl::wayland, which only exists with wayland_platform. The clipboard items are now gated on wayland_platform. - Rust 1.70.0 on Windows: update_system_caret is pub but takes the pub(crate) CaretChange (E0446); it is pub(crate) now. - ime_patches/pointer_patches read sources with CRLF on a Windows checkout (* text=auto) and missed patterns that span lines; source() normalizes to LF. Co-Authored-By: Claude Opus 5.5 --- src/keyboard.rs | 6 +++--- src/platform/wayland.rs | 7 +++++++ src/platform_impl/windows/dark_mode.rs | 2 +- src/platform_impl/windows/ime.rs | 2 +- tests/ime_patches.rs | 6 +++++- tests/pointer_patches.rs | 6 +++++- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/keyboard.rs b/src/keyboard.rs index 7b406f08..5406b3b3 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -548,10 +548,10 @@ pub enum KeyCode { NumpadMemoryStore, /// M Subtract current entry from the value stored in memory. NumpadMemorySubtract, - /// * on a keyboard. For use with numpads that provide mathematical - /// operations (+, - * and /). + /// \* on a keyboard. For use with numpads that provide mathematical + /// operations (+, - \* and /). /// - /// Use `NumpadStar` for the * key on phones and remote controls. + /// Use `NumpadStar` for the \* key on phones and remote controls. NumpadMultiply, /// ( Found on the Microsoft Natural Keyboard. NumpadParenLeft, diff --git a/src/platform/wayland.rs b/src/platform/wayland.rs index 5e3fc81a..0b54d97f 100644 --- a/src/platform/wayland.rs +++ b/src/platform/wayland.rs @@ -25,6 +25,8 @@ use crate::window::{Window, WindowAttributes, WindowId}; pub use crate::window::Theme; +// The clipboard needs the Wayland backend, which docs built for other platforms (`docsrs`) lack. +#[cfg(wayland_platform)] pub use crate::platform_impl::wayland::clipboard::{ ClipboardContent, ClipboardError, ImageClaimReservation, InputOriginToken, PngBytes, PngBytesWriter, RegularTransferHandle, SelectionClaim, TransferHandle, TransferOptions, @@ -37,6 +39,7 @@ pub trait ActiveEventLoopExtWayland { fn is_wayland(&self) -> bool; /// The clipboard of this event loop, or [`None`] if it doesn't use Wayland. + #[cfg(wayland_platform)] fn clipboard(&self) -> Option; } @@ -46,6 +49,7 @@ impl ActiveEventLoopExtWayland for ActiveEventLoop { self.p.is_wayland() } + #[cfg(wayland_platform)] fn clipboard(&self) -> Option { #[allow(clippy::single_match)] match &self.p { @@ -81,11 +85,13 @@ impl ActiveEventLoopExtWayland for ActiveEventLoop { /// `input_origin` and `reserve_image_claim` are synchronous state transitions used at that same /// input/output boundary. This is a caller contract; the type does not inspect which thread is /// currently calling it. +#[cfg(wayland_platform)] #[derive(Clone)] pub struct Clipboard { state: Weak, } +#[cfg(wayland_platform)] impl Clipboard { /// The clipboard of the winit event loop connected through `display`, a `wl_display` /// pointer such as the one in its `WaylandDisplayHandle`, if that event loop still exists. @@ -281,6 +287,7 @@ impl Clipboard { } } +#[cfg(wayland_platform)] impl fmt::Debug for Clipboard { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Clipboard").finish_non_exhaustive() diff --git a/src/platform_impl/windows/dark_mode.rs b/src/platform_impl/windows/dark_mode.rs index e1590d2a..a499365f 100644 --- a/src/platform_impl/windows/dark_mode.rs +++ b/src/platform_impl/windows/dark_mode.rs @@ -1,5 +1,5 @@ /// This is a simple implementation of support for Windows Dark Mode, -/// which is inspired by the solution in https://github.com/ysc3839/win32-darkmode +/// which is inspired by the solution in use std::{ffi::c_void, ptr}; use crate::utils::Lazy; diff --git a/src/platform_impl/windows/ime.rs b/src/platform_impl/windows/ime.rs index 24131d9a..af1d2168 100644 --- a/src/platform_impl/windows/ime.rs +++ b/src/platform_impl/windows/ime.rs @@ -182,7 +182,7 @@ impl ImeContext { /// Applies a change to the hidden system caret that follows the IME cursor area /// (`ime_caret.rs`). Runs on the window's thread, which owns the caret. - pub unsafe fn update_system_caret(hwnd: HWND, change: Option) { + pub(crate) unsafe fn update_system_caret(hwnd: HWND, change: Option) { match change { None => {}, // A new caret is hidden, and this one is never shown. diff --git a/tests/ime_patches.rs b/tests/ime_patches.rs index 59aee99b..532fd279 100644 --- a/tests/ime_patches.rs +++ b/tests/ime_patches.rs @@ -6,9 +6,13 @@ use std::path::Path; +/// The source with `\n` line endings: a Windows checkout has `\r\n` (`* text=auto`), and some +/// tests match code that spans lines. fn source(path: &str) -> String { let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("src/platform_impl").join(path); - std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("{}: {err}", path.display())) + std::fs::read_to_string(&path) + .unwrap_or_else(|err| panic!("{}: {err}", path.display())) + .replace("\r\n", "\n") } /// The text after `start`, up to the first `end`. diff --git a/tests/pointer_patches.rs b/tests/pointer_patches.rs index 64648e98..953d4fde 100644 --- a/tests/pointer_patches.rs +++ b/tests/pointer_patches.rs @@ -6,9 +6,13 @@ use std::path::Path; +/// The source with `\n` line endings: a Windows checkout has `\r\n` (`* text=auto`), and some +/// tests match code that spans lines. fn source(path: &str) -> String { let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("src/platform_impl").join(path); - std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("{}: {err}", path.display())) + std::fs::read_to_string(&path) + .unwrap_or_else(|err| panic!("{}: {err}", path.display())) + .replace("\r\n", "\n") } /// The text after `start`, up to the first `end`.