Skip to content

Commit

Permalink
Update MSRV for windows crate to 1.62 (#2730)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Dec 7, 2023
1 parent 43bcb74 commit 44eadca
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Check
strategy:
matrix:
rust: [1.56.0, stable, nightly]
rust: [1.62.0, stable, nightly]
runs-on:
- windows-2019
- ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows-core"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.62"
license = "MIT OR Apache-2.0"
description = "Rust for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
9 changes: 0 additions & 9 deletions crates/libs/core/src/imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ pub use sha1::*;
pub use waiter::*;
pub use weak_ref_count::*;

// This is a workaround since 1.56 does not include `bool::then_some`.
pub fn then_some<T>(value: bool, t: T) -> Option<T> {
if value {
Some(t)
} else {
None
}
}

pub fn wide_trim_end(mut wide: &[u16]) -> &[u16] {
while let Some(last) = wide.last() {
match last {
Expand Down
6 changes: 3 additions & 3 deletions crates/libs/core/src/imp/weak_ref_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ impl WeakRefCount {
}

pub fn add_ref(&self) -> u32 {
self.0.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |count_or_pointer| then_some(!is_weak_ref(count_or_pointer), count_or_pointer + 1)).map(|u| u as u32 + 1).unwrap_or_else(|pointer| unsafe { TearOff::decode(pointer).strong_count.add_ref() })
self.0.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |count_or_pointer| bool::then_some(!is_weak_ref(count_or_pointer), count_or_pointer + 1)).map(|u| u as u32 + 1).unwrap_or_else(|pointer| unsafe { TearOff::decode(pointer).strong_count.add_ref() })
}

pub fn release(&self) -> u32 {
self.0.fetch_update(Ordering::Release, Ordering::Relaxed, |count_or_pointer| then_some(!is_weak_ref(count_or_pointer), count_or_pointer - 1)).map(|u| u as u32 - 1).unwrap_or_else(|pointer| unsafe {
self.0.fetch_update(Ordering::Release, Ordering::Relaxed, |count_or_pointer| bool::then_some(!is_weak_ref(count_or_pointer), count_or_pointer - 1)).map(|u| u as u32 - 1).unwrap_or_else(|pointer| unsafe {
let tear_off = TearOff::decode(pointer);
let remaining = tear_off.strong_count.release();

Expand Down Expand Up @@ -222,7 +222,7 @@ impl TearOff {
.fetch_update(Ordering::Acquire, Ordering::Relaxed, |count| {
// Attempt to acquire a strong reference count to stabilize the object for the duration
// of the `QueryInterface` call.
then_some(count != 0, count + 1)
bool::then_some(count != 0, count + 1)
})
.map(|_| {
// Let the object respond to the upgrade query.
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/windows/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "windows"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.62"
license = "MIT OR Apache-2.0"
description = "Rust for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down

0 comments on commit 44eadca

Please sign in to comment.