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

View file

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

View file

@ -6,13 +6,13 @@ use intentional::Assert;
use kludgine::app::winit::event::Modifiers;
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
/// <https://github.com/rust-lang/rust/issues/118009> for more information.
#[derive(Debug, Default)]
pub struct UnwindsafeCondvar(
#[cfg(any(target_os = "ios", target_os = "macos"))] std::panic::AssertUnwindSafe<Condvar>,
#[cfg(not(any(target_os = "ios", target_os = "macos")))] 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", target_os = "windows")))] Condvar,
);
impl Deref for UnwindsafeCondvar {
@ -25,12 +25,12 @@ impl Deref for UnwindsafeCondvar {
impl UnwindsafeCondvar {
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()))
}
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "windows")))]
{
Self(Condvar::new())
}

View file

@ -5,7 +5,6 @@ use std::ffi::OsStr;
use std::ops::{Deref, DerefMut, Not};
use std::panic::{AssertUnwindSafe, UnwindSafe};
use std::path::Path;
use std::process::Command;
use std::string::ToString;
use std::sync::{MutexGuard, OnceLock};
@ -1340,7 +1339,7 @@ impl Ranged for ThemeMode {
}
#[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.
None
}
@ -1360,7 +1359,7 @@ fn default_family(query: Family<'_>) -> Option<FamilyOwned> {
Family::Name(_) => return None,
};
Command::new("fc-match")
std::process::Command::new("fc-match")
.arg("-f")
.arg("%{family}")
.arg(query)