Skip to content

Commit

Permalink
update rust version to 1.57
Browse files Browse the repository at this point in the history
  • Loading branch information
kaivol committed Sep 6, 2023
1 parent 2601dbe commit 3162896
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows-sys.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.57.0, stable, nightly]
runs-on:
- windows-latest
- ubuntu-latest
Expand Down
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.57.0, stable, nightly]
runs-on:
- windows-2019
- ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows-bindgen"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Windows metadata compiler"
repository = "https://github.com/microsoft/windows-rs"
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.57"
license = "MIT OR Apache-2.0"
description = "Rust for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/core/src/imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use sha1::*;
pub use waiter::*;
pub use weak_ref_count::*;

// This is a workaround since 1.56 does not include `bool::then_some`.
// This is a workaround since 1.57 does not include `bool::then_some`.
pub fn then_some<T>(value: bool, t: T) -> Option<T> {
if value {
Some(t)
Expand Down
62 changes: 32 additions & 30 deletions crates/libs/core/src/implement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ impl<Impl: ComObjectImpl> Deref for ComObject<Impl> {
}
}

struct ValidateInterfaces<Impl, Int> {
_marker: marker::PhantomData<(Impl, Int)>,
}
struct ValidateInterfaces<Impl, Int> { _marker: marker::PhantomData<(Impl, Int)> }

impl<Impl: ComObjectImpl, Int: Iids> ValidateInterfaces<Impl, Int> {
const VALID: () = {
if Int::IID.to_u128() == IUnknown::IID.to_u128() {
Expand All @@ -332,50 +331,53 @@ impl<Impl: ComObjectImpl, Int: Iids> ValidateInterfaces<Impl, Int> {
if Int::IID.to_u128() == IWeakReferenceSource::IID.to_u128() {
panic!("can not manually implement `IWeakReferenceSource`");
}
if !Self::required_interfaces(Impl::Interfaces::INTERFACES, Int::REQUIRED_IIDS) {
if !required_interfaces(Impl::Interfaces::INTERFACES, Int::REQUIRED_IIDS) {
panic!("not all required interfaces are implemented");
}
};
const fn required_interfaces(interfaces: &[&[GUID]], required_iids: &[GUID]) -> bool {
let mut required_iids_index = 0;
'required: while required_iids_index < required_iids.len() {
let required_iid = required_iids[required_iids_index];

let mut interface_index = 0;
while interface_index < interfaces.len() {
let interface = interfaces[interface_index];
if contains(interface, required_iid) {
required_iids_index += 1;
continue 'required;
}
interface_index += 1;
}

const fn required_interfaces(interfaces: &[&[GUID]], required_iids: &[GUID]) -> bool {
let mut required_iids_index = 0;
'required: while required_iids_index < required_iids.len() {
let required_iid = required_iids[required_iids_index];

let mut interface_index = 0;
while interface_index < interfaces.len() {
let interface = interfaces[interface_index];
if contains(interface, required_iid) {
required_iids_index += 1;
continue 'required;
}
return false;
interface_index += 1;
}
true
return false;
}
true
}

struct CheckCast<Impl, Int> { _marker: marker::PhantomData<(Impl, Int)>, }
struct CheckCast<Impl, Int> { _marker: marker::PhantomData<(Impl, Int)> }

impl<Impl: ComObjectImpl, Int: ComInterface> CheckCast<Impl, Int> {
const VALID: usize = {
if let Some(offset) = Self::check_cast(Impl::Interfaces::INTERFACES, Int::IID) {
if let Some(offset) = check_cast(Impl::Interfaces::INTERFACES, Int::IID) {
offset
} else {
panic!("invalid cast. Interface not implemented");
}
};
const fn check_cast(interfaces: &[&[GUID]], query: GUID) -> Option<usize> {
let mut i = 0;
while i < interfaces.len() {
let interface = interfaces[i];
if contains(interface, query) {
return Some(i);
}
i += 1;
}

const fn check_cast(interfaces: &[&[GUID]], query: GUID) -> Option<usize> {
let mut i = 0;
while i < interfaces.len() {
let interface = interfaces[i];
if contains(interface, query) {
return Some(i);
}
None
i += 1;
}
None
}

const fn contains(iids: &[GUID], iid: GUID) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows-sys"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Rust for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/targets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "windows-targets"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import libs for Windows"
repository = "https://github.com/microsoft/windows-rs"
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.57"
license = "MIT OR Apache-2.0"
description = "Rust for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/aarch64_gnullvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_aarch64_gnullvm"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/aarch64_msvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_aarch64_msvc"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/i686_gnu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_i686_gnu"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/i686_msvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_i686_msvc"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/x86_64_gnu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_x86_64_gnu"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/x86_64_gnullvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_x86_64_gnullvm"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/targets/x86_64_msvc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "windows_x86_64_msvc"
version = "0.52.0"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Import lib for Windows"
repository = "https://github.com/microsoft/windows-rs"
Expand Down
2 changes: 1 addition & 1 deletion crates/tools/riddle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "riddle"
version = "0.0.1"
authors = ["Microsoft"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
license = "MIT OR Apache-2.0"
description = "Windows metadata compiler"
repository = "https://github.com/microsoft/windows-rs"
Expand Down

0 comments on commit 3162896

Please sign in to comment.