From 4f2f0575082c4d7ce99b085ff2c4a0ff6735e12d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 11 May 2024 20:01:40 +0200 Subject: [PATCH 1/3] Update arboard (#4482) Updating arboard v3.3.1 -> v3.4.0 Updating clipboard-win v5.1.0 -> v5.3.1 --- Cargo.lock | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4466ae0f344..e751dd77f23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,17 +199,16 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arboard" -version = "3.3.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1faa3c733d9a3dd6fbaf85da5d162a2e03b2e0033a90dceb0e2a90fdd1e5380a" +checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" dependencies = [ "clipboard-win", "log", - "objc", - "objc-foundation", - "objc_id", + "objc2 0.5.1", + "objc2-app-kit", + "objc2-foundation", "parking_lot", - "thiserror", "x11rb", ] @@ -797,9 +796,9 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clipboard-win" -version = "5.1.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81" +checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad" dependencies = [ "error-code", ] @@ -1146,7 +1145,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.0", + "libloading 0.7.4", ] [[package]] @@ -1958,7 +1957,7 @@ dependencies = [ "bitflags 2.5.0", "com", "libc", - "libloading 0.8.0", + "libloading 0.7.4", "thiserror", "widestring", "winapi", @@ -4321,7 +4320,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.0", + "libloading 0.7.4", "log", "metal", "naga", From 059218d954cfbe272e1958a91dfecb701abed7a1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 11 May 2024 20:17:06 +0200 Subject: [PATCH 2/3] eframe: Remove dependency on `thiserror` (#4483) Less dependencies => faster compile times * Part of https://github.com/emilk/egui/issues/4481 --- Cargo.lock | 1 - crates/eframe/Cargo.toml | 1 - crates/eframe/src/lib.rs | 99 +++++++++++++++++++++++++++++++++++----- 3 files changed, 87 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e751dd77f23..198494929e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1203,7 +1203,6 @@ dependencies = [ "ron", "serde", "static_assertions", - "thiserror", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index c5cfae87733..33cc5ba6bfe 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -134,7 +134,6 @@ log.workspace = true parking_lot.workspace = true raw-window-handle.workspace = true static_assertions = "1.1.0" -thiserror.workspace = true web-time.workspace = true # Optional dependencies diff --git a/crates/eframe/src/lib.rs b/crates/eframe/src/lib.rs index 98576358a70..e1df19a8b0b 100644 --- a/crates/eframe/src/lib.rs +++ b/crates/eframe/src/lib.rs @@ -331,37 +331,112 @@ pub fn run_simple_native( // ---------------------------------------------------------------------------- /// The different problems that can occur when trying to run `eframe`. -#[derive(thiserror::Error, Debug)] +#[derive(Debug)] pub enum Error { /// An error from [`winit`]. #[cfg(not(target_arch = "wasm32"))] - #[error("winit error: {0}")] - Winit(#[from] winit::error::OsError), + Winit(winit::error::OsError), /// An error from [`winit::event_loop::EventLoop`]. #[cfg(not(target_arch = "wasm32"))] - #[error("winit EventLoopError: {0}")] - WinitEventLoop(#[from] winit::error::EventLoopError), + WinitEventLoop(winit::error::EventLoopError), /// An error from [`glutin`] when using [`glow`]. #[cfg(all(feature = "glow", not(target_arch = "wasm32")))] - #[error("glutin error: {0}")] - Glutin(#[from] glutin::error::Error), + Glutin(glutin::error::Error), /// An error from [`glutin`] when using [`glow`]. #[cfg(all(feature = "glow", not(target_arch = "wasm32")))] - #[error("Found no glutin configs matching the template: {0:?}. Error: {1:?}")] NoGlutinConfigs(glutin::config::ConfigTemplate, Box), /// An error from [`glutin`] when using [`glow`]. #[cfg(feature = "glow")] - #[error("egui_glow: {0}")] - OpenGL(#[from] egui_glow::PainterError), + OpenGL(egui_glow::PainterError), /// An error from [`wgpu`]. #[cfg(feature = "wgpu")] - #[error("WGPU error: {0}")] - Wgpu(#[from] egui_wgpu::WgpuError), + Wgpu(egui_wgpu::WgpuError), +} + +impl std::error::Error for Error {} + +#[cfg(not(target_arch = "wasm32"))] +impl From for Error { + #[inline] + fn from(err: winit::error::OsError) -> Self { + Self::Winit(err) + } +} + +#[cfg(not(target_arch = "wasm32"))] +impl From for Error { + #[inline] + fn from(err: winit::error::EventLoopError) -> Self { + Self::WinitEventLoop(err) + } +} + +#[cfg(all(feature = "glow", not(target_arch = "wasm32")))] +impl From for Error { + #[inline] + fn from(err: glutin::error::Error) -> Self { + Self::Glutin(err) + } +} + +#[cfg(feature = "glow")] +impl From for Error { + #[inline] + fn from(err: egui_glow::PainterError) -> Self { + Self::OpenGL(err) + } +} + +#[cfg(feature = "wgpu")] +impl From for Error { + #[inline] + fn from(err: egui_wgpu::WgpuError) -> Self { + Self::Wgpu(err) + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + #[cfg(not(target_arch = "wasm32"))] + Self::Winit(err) => { + write!(f, "winit error: {err}") + } + + #[cfg(not(target_arch = "wasm32"))] + Self::WinitEventLoop(err) => { + write!(f, "winit EventLoopError: {err}") + } + + #[cfg(all(feature = "glow", not(target_arch = "wasm32")))] + Self::Glutin(err) => { + write!(f, "glutin error: {err}") + } + + #[cfg(all(feature = "glow", not(target_arch = "wasm32")))] + Self::NoGlutinConfigs(template, err) => { + write!( + f, + "Found no glutin configs matching the template: {template:?}. Error: {err}" + ) + } + + #[cfg(feature = "glow")] + Self::OpenGL(err) => { + write!(f, "egui_glow: {err}") + } + + #[cfg(feature = "wgpu")] + Self::Wgpu(err) => { + write!(f, "WGPU error: {err}") + } + } + } } /// Short for `Result`. From c3f386aa301f26106397c4e14434bd5a734ba6b6 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 11 May 2024 20:17:19 +0200 Subject: [PATCH 3/3] Remove work-around for `unsafe` in puffin macro (#4484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …since it is no longer in the puffin macro --- crates/egui/src/lib.rs | 2 -- crates/egui_demo_lib/src/lib.rs | 2 -- crates/egui_extras/src/lib.rs | 2 -- crates/emath/src/lib.rs | 2 -- crates/epaint/src/lib.rs | 2 -- 5 files changed, 10 deletions(-) diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index a846acc701e..b367158a58b 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -371,8 +371,6 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![cfg_attr(feature = "puffin", deny(unsafe_code))] -#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod animation_manager; pub mod containers; diff --git a/crates/egui_demo_lib/src/lib.rs b/crates/egui_demo_lib/src/lib.rs index 7dba93b4117..68bdc8eed85 100644 --- a/crates/egui_demo_lib/src/lib.rs +++ b/crates/egui_demo_lib/src/lib.rs @@ -10,8 +10,6 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![cfg_attr(feature = "puffin", deny(unsafe_code))] -#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod demo; pub mod easy_mark; diff --git a/crates/egui_extras/src/lib.rs b/crates/egui_extras/src/lib.rs index e899106cd45..381242c90b5 100644 --- a/crates/egui_extras/src/lib.rs +++ b/crates/egui_extras/src/lib.rs @@ -8,8 +8,6 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![cfg_attr(feature = "puffin", deny(unsafe_code))] -#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] #[cfg(feature = "chrono")] mod datepicker; diff --git a/crates/emath/src/lib.rs b/crates/emath/src/lib.rs index 4ac46f21947..6ad48bd2543 100644 --- a/crates/emath/src/lib.rs +++ b/crates/emath/src/lib.rs @@ -20,8 +20,6 @@ //! #![allow(clippy::float_cmp)] -#![cfg_attr(feature = "puffin", deny(unsafe_code))] -#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] use std::ops::{Add, Div, Mul, RangeInclusive, Sub}; diff --git a/crates/epaint/src/lib.rs b/crates/epaint/src/lib.rs index db48fce6876..d5e7055813b 100644 --- a/crates/epaint/src/lib.rs +++ b/crates/epaint/src/lib.rs @@ -22,8 +22,6 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] -#![cfg_attr(feature = "puffin", deny(unsafe_code))] -#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))] mod bezier; pub mod color;