Fixing compilation on Windows

Condvar isn't UnwindSafe on Windows either. See
rust-lang/rust#118009
This commit is contained in:
Jonathan Johnson 2023-12-18 17:10:04 -08:00
parent 7dc00f27e0
commit a1e3082527
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
4 changed files with 13 additions and 14 deletions

8
Cargo.lock generated
View file

@ -89,9 +89,9 @@ dependencies = [
[[package]] [[package]]
name = "appit" name = "appit"
version = "0.1.0" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c843008d81c05e90e716349b2fa73017583f40965bf1651a34fa5fa7159eeef7" checksum = "e3441f2d5169d7cce48f58cc16a802b6bb6e9e3edf80712ac56c681a09b92ae0"
dependencies = [ dependencies = [
"winit", "winit",
] ]
@ -3165,9 +3165,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.28" version = "0.5.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View file

@ -38,8 +38,8 @@ unicode-segmentation = "1.10.1"
# [patch."https://github.com/khonsulabs/kludgine"] # [patch."https://github.com/khonsulabs/kludgine"]
# kludgine = { path = "../kludgine" } # kludgine = { path = "../kludgine" }
# [patch."https://github.com/khonsulabs/appit"] # [patch.crates-io]
# appit = { path = "../appit" } # appit = { version = "0.1.0", path = "../appit" }
# [patch."https://github.com/khonsulabs/figures"] # [patch."https://github.com/khonsulabs/figures"]
# figures = { path = "../figures" } # figures = { path = "../figures" }

View file

@ -6,13 +6,13 @@ use intentional::Assert;
use kludgine::app::winit::event::Modifiers; use kludgine::app::winit::event::Modifiers;
use kludgine::app::winit::keyboard::ModifiersState; use kludgine::app::winit::keyboard::ModifiersState;
/// This [`Condvar`] is a wrapper that on Mac OS/iOS asserts unwind safety. On /// This [`Condvar`] is a wrapper that on Mac OS/iOS/Windows asserts unwind safety. On
/// all other platforms, this is a transparent wrapper around `Condvar`. See /// all other platforms, this is a transparent wrapper around `Condvar`. See
/// <https://github.com/rust-lang/rust/issues/118009> for more information. /// <https://github.com/rust-lang/rust/issues/118009> for more information.
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct UnwindsafeCondvar( pub struct UnwindsafeCondvar(
#[cfg(any(target_os = "ios", target_os = "macos"))] std::panic::AssertUnwindSafe<Condvar>, #[cfg(any(target_os = "ios", target_os = "macos", target_os = "windows"))] std::panic::AssertUnwindSafe<Condvar>,
#[cfg(not(any(target_os = "ios", target_os = "macos")))] Condvar, #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "windows")))] Condvar,
); );
impl Deref for UnwindsafeCondvar { impl Deref for UnwindsafeCondvar {
@ -25,12 +25,12 @@ impl Deref for UnwindsafeCondvar {
impl UnwindsafeCondvar { impl UnwindsafeCondvar {
pub const fn new() -> Self { pub const fn new() -> Self {
#[cfg(any(target_os = "ios", target_os = "macos"))] #[cfg(any(target_os = "ios", target_os = "macos", target_os = "windows"))]
{ {
Self(std::panic::AssertUnwindSafe(Condvar::new())) Self(std::panic::AssertUnwindSafe(Condvar::new()))
} }
#[cfg(not(any(target_os = "ios", target_os = "macos")))] #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "windows")))]
{ {
Self(Condvar::new()) Self(Condvar::new())
} }

View file

@ -5,7 +5,6 @@ use std::ffi::OsStr;
use std::ops::{Deref, DerefMut, Not}; use std::ops::{Deref, DerefMut, Not};
use std::panic::{AssertUnwindSafe, UnwindSafe}; use std::panic::{AssertUnwindSafe, UnwindSafe};
use std::path::Path; use std::path::Path;
use std::process::Command;
use std::string::ToString; use std::string::ToString;
use std::sync::{MutexGuard, OnceLock}; use std::sync::{MutexGuard, OnceLock};
@ -1340,7 +1339,7 @@ impl Ranged for ThemeMode {
} }
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "windows"))] #[cfg(any(target_os = "macos", target_os = "ios", target_os = "windows"))]
fn default_family(query: Family<'_>) -> Option<FamilyOwned> { fn default_family(_query: Family<'_>) -> Option<FamilyOwned> {
// fontdb uses system APIs to determine these defaults. // fontdb uses system APIs to determine these defaults.
None None
} }
@ -1360,7 +1359,7 @@ fn default_family(query: Family<'_>) -> Option<FamilyOwned> {
Family::Name(_) => return None, Family::Name(_) => return None,
}; };
Command::new("fc-match") std::process::Command::new("fc-match")
.arg("-f") .arg("-f")
.arg("%{family}") .arg("%{family}")
.arg(query) .arg(query)