diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2e425ae2..287e49bec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,9 +87,10 @@ That's it! Thank you for your contribution! The following tools should be installed as a part of the `windows-drivers-rs` developer workflow: -* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.85` * `cargo-audit`: `cargo install --locked cargo-audit` +* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.85` * `cargo-machete`: `cargo install --locked cargo-machete` +* `cargo-sort`: `cargo install --locked cargo-sort` * `taplo-cli`: `cargo install --locked taplo-cli` * `typos-cli`: `cargo install --locked typos-cli` diff --git a/Cargo.toml b/Cargo.toml index d044b9b28..8de2e6763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ exclude = [ resolver = "3" [workspace.package] -edition = "2021" -rust-version = "1.84.0" +edition = "2024" +rust-version = "1.85.0" repository = "https://github.com/microsoft/windows-drivers-rs" readme = "README.md" license = "MIT OR Apache-2.0" diff --git a/README.md b/README.md index 24e871563..f48811513 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,9 @@ The crates in this repository are available from [`crates.io`](https://crates.io PCUNICODE_STRING, }; - #[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry + // SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. + // No other function in this compilation unit exports this name, preventing symbol conflicts. + #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/crates/cargo-wdk/src/actions/build/build_task.rs b/crates/cargo-wdk/src/actions/build/build_task.rs index f4a7af11c..d81f4b1f4 100644 --- a/crates/cargo-wdk/src/actions/build/build_task.rs +++ b/crates/cargo-wdk/src/actions/build/build_task.rs @@ -14,7 +14,7 @@ use tracing::debug; #[double] use crate::providers::exec::CommandExec; use crate::{ - actions::{build::error::BuildTaskError, to_target_triple, Profile, TargetArch}, + actions::{Profile, TargetArch, build::error::BuildTaskError, to_target_triple}, trace, }; diff --git a/crates/cargo-wdk/src/actions/build/mod.rs b/crates/cargo-wdk/src/actions/build/mod.rs index d920a8f3c..5aadd9577 100644 --- a/crates/cargo-wdk/src/actions/build/mod.rs +++ b/crates/cargo-wdk/src/actions/build/mod.rs @@ -13,7 +13,7 @@ mod package_task; #[cfg(test)] mod tests; use std::{ - path::{absolute, Path, PathBuf}, + path::{Path, PathBuf, absolute}, result::Result::Ok, }; @@ -26,7 +26,7 @@ use package_task::{PackageTask, PackageTaskParams}; use tracing::{debug, error as err, info, warn}; use wdk_build::metadata::{TryFromCargoMetadataError, Wdk}; -use crate::actions::{to_target_triple, Profile, TargetArch}; +use crate::actions::{Profile, TargetArch, to_target_triple}; #[double] use crate::providers::{exec::CommandExec, fs::Fs, metadata::Metadata, wdk_build::WdkBuild}; diff --git a/crates/cargo-wdk/src/actions/build/tests.rs b/crates/cargo-wdk/src/actions/build/tests.rs index 992c614a0..dd2ff9ccd 100644 --- a/crates/cargo-wdk/src/actions/build/tests.rs +++ b/crates/cargo-wdk/src/actions/build/tests.rs @@ -14,9 +14,9 @@ use cargo_metadata::Metadata as CargoMetadata; use mockall::predicate::eq; use mockall_double::double; use wdk_build::{ - metadata::{TryFromCargoMetadataError, Wdk}, CpuArchitecture, DriverConfig, + metadata::{TryFromCargoMetadataError, Wdk}, }; #[double] @@ -28,10 +28,10 @@ use crate::providers::{ }; use crate::{ actions::{ - build::{BuildAction, BuildActionError, BuildActionParams}, - to_target_triple, Profile, TargetArch, + build::{BuildAction, BuildActionError, BuildActionParams}, + to_target_triple, }, providers::error::{CommandError, FileError}, }; @@ -139,8 +139,8 @@ pub fn given_a_driver_project_when_target_arch_is_arm64_then_it_builds_successfu } #[test] -pub fn given_a_driver_project_when_profile_is_release_and_target_arch_is_arm64_then_it_builds_successfully( -) { +pub fn given_a_driver_project_when_profile_is_release_and_target_arch_is_arm64_then_it_builds_successfully() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = Some(Profile::Release); @@ -781,8 +781,8 @@ pub fn given_a_driver_project_when_infverif_command_execution_fails_then_package } #[test] -pub fn given_a_non_driver_project_when_default_values_are_provided_with_no_wdk_metadata_are_provided_then_build_should_be_successful( -) { +pub fn given_a_non_driver_project_when_default_values_are_provided_with_no_wdk_metadata_are_provided_then_build_should_be_successful() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -811,8 +811,8 @@ pub fn given_a_non_driver_project_when_default_values_are_provided_with_no_wdk_m } #[test] -pub fn given_a_invalid_driver_project_with_partial_wdk_metadata_when_valid_default_values_are_provided_then_wdk_metadata_parse_should_fail( -) { +pub fn given_a_invalid_driver_project_with_partial_wdk_metadata_when_valid_default_values_are_provided_then_wdk_metadata_parse_should_fail() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp\\sample-driver"); let profile = None; @@ -851,8 +851,8 @@ pub fn given_a_invalid_driver_project_with_partial_wdk_metadata_when_valid_defau /// Workspace tests //////////////////////////////////////////////////////////////////////////////// #[test] -pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_default_values_are_provided_then_it_packages_successfully( -) { +pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_default_values_are_provided_then_it_packages_successfully() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -923,8 +923,8 @@ pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_defau } #[test] -pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_is_driver_project_then_it_packages_driver_project_successfully( -) { +pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_is_driver_project_then_it_packages_driver_project_successfully() + { // Input CLI args let workspace_root_dir = PathBuf::from("C:\\tmp"); let cwd = workspace_root_dir.join("sample-kmdf-1"); @@ -1011,8 +1011,8 @@ pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_i } #[test] -pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_verify_signature_is_false_then_it_skips_verify_tasks( -) { +pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_verify_signature_is_false_then_it_skips_verify_tasks() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -1083,8 +1083,8 @@ pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_verif } #[test] -pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_is_non_driver_project_then_it_builds_but_skips_packaging( -) { +pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_is_non_driver_project_then_it_builds_but_skips_packaging() + { // Input CLI args let workspace_root_dir = PathBuf::from("C:\\tmp"); let cwd = workspace_root_dir.join("non-driver"); @@ -1147,8 +1147,8 @@ pub fn given_a_workspace_with_multiple_driver_and_non_driver_projects_when_cwd_i } #[test] -pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_each_workspace_member_level_when_default_values_are_provided_then_wdk_metadata_parse_should_fail( -) { +pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_each_workspace_member_level_when_default_values_are_provided_then_wdk_metadata_parse_should_fail() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -1214,8 +1214,8 @@ pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_each_works } #[test] -pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_root_and_workspace_member_level_when_default_values_are_provided_then_wdk_metadata_parse_should_fail( -) { +pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_root_and_workspace_member_level_when_default_values_are_provided_then_wdk_metadata_parse_should_fail() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -1281,8 +1281,8 @@ pub fn given_a_workspace_with_multiple_distinct_wdk_configurations_at_root_and_w } #[test] -pub fn given_a_workspace_only_with_non_driver_projects_when_cwd_is_workspace_root_then_build_should_be_successful( -) { +pub fn given_a_workspace_only_with_non_driver_projects_when_cwd_is_workspace_root_then_build_should_be_successful() + { // Input CLI args let cwd = PathBuf::from("C:\\tmp"); let profile = None; @@ -1318,8 +1318,8 @@ pub fn given_a_workspace_only_with_non_driver_projects_when_cwd_is_workspace_roo } #[test] -pub fn given_a_workspace_only_with_non_driver_projects_when_cwd_is_workspace_member_then_build_should_be_successful( -) { +pub fn given_a_workspace_only_with_non_driver_projects_when_cwd_is_workspace_member_then_build_should_be_successful() + { // Input CLI args let workspace_root_dir = PathBuf::from("C:\\tmp"); let cwd = workspace_root_dir.join("non-driver"); @@ -1727,7 +1727,7 @@ impl TestBuildAction { &manifest_path, ] .into_iter() - .map(std::string::ToString::to_string) + .map(ToString::to_string) .collect(); if let Some(profile) = self.profile { expected_cargo_build_args.push("--profile".to_string()); diff --git a/crates/cargo-wdk/src/actions/new/mod.rs b/crates/cargo-wdk/src/actions/new/mod.rs index 8c667e895..3cbc3be84 100644 --- a/crates/cargo-wdk/src/actions/new/mod.rs +++ b/crates/cargo-wdk/src/actions/new/mod.rs @@ -15,7 +15,7 @@ use std::{ use clap_verbosity_flag::Verbosity; use error::NewActionError; -use include_dir::{include_dir, Dir}; +use include_dir::{Dir, include_dir}; use mockall_double::double; use tracing::{debug, info}; diff --git a/crates/cargo-wdk/src/cli.rs b/crates/cargo-wdk/src/cli.rs index f7d1db07e..7d13908df 100644 --- a/crates/cargo-wdk/src/cli.rs +++ b/crates/cargo-wdk/src/cli.rs @@ -12,14 +12,14 @@ use mockall_double::double; use wdk_build::CpuArchitecture; use crate::actions::{ - build::{BuildAction, BuildActionParams}, - new::NewAction, DriverType, + KMDF_STR, Profile, TargetArch, - KMDF_STR, UMDF_STR, WDM_STR, + build::{BuildAction, BuildActionParams}, + new::NewAction, }; #[double] use crate::providers::{exec::CommandExec, fs::Fs, metadata::Metadata, wdk_build::WdkBuild}; diff --git a/crates/cargo-wdk/src/providers/fs.rs b/crates/cargo-wdk/src/providers/fs.rs index 425ec50c2..b9f1a93a7 100644 --- a/crates/cargo-wdk/src/providers/fs.rs +++ b/crates/cargo-wdk/src/providers/fs.rs @@ -11,7 +11,7 @@ #![allow(clippy::unused_self)] use std::{ - fs::{copy, create_dir, read_dir, rename, DirEntry, File, FileType, OpenOptions}, + fs::{DirEntry, File, FileType, OpenOptions, copy, create_dir, read_dir, rename}, io::{Read, Write}, path::Path, }; diff --git a/crates/cargo-wdk/src/test_utils.rs b/crates/cargo-wdk/src/test_utils.rs index 0ddfe938b..7f99ba437 100644 --- a/crates/cargo-wdk/src/test_utils.rs +++ b/crates/cargo-wdk/src/test_utils.rs @@ -39,9 +39,9 @@ where // Remove the env var if value is None if let Some(value) = value { - std::env::set_var(key, value); + set_var(key, value); } else { - std::env::remove_var(key); + remove_var(key); } } @@ -51,13 +51,83 @@ where for (key, _) in env_vars_key_value_pairs { original_env_vars.get(key).map_or_else( || { - std::env::remove_var(key); + remove_var(key); }, |value| { - std::env::set_var(key, value); + set_var(key, value); }, ); } f_return_value } + +/// Safely sets an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::set_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[cfg(target_os = "windows")] +pub fn set_var(key: K, value: V) +where + K: AsRef, + V: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::set_var is always safe for windows targets + unsafe { + std::env::set_var(key, value); + } +} + +#[cfg(not(target_os = "windows"))] +pub fn set_var(_key: K, _value: V) +where + K: AsRef, + V: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} + +/// Safely removes an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::remove_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[allow(dead_code)] +#[cfg(target_os = "windows")] +pub fn remove_var(key: K) +where + K: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::remove_var is always safe for windows targets + unsafe { + std::env::remove_var(key); + } +} + +#[allow(dead_code)] +#[cfg(not(target_os = "windows"))] +pub fn remove_var(_key: K) +where + K: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} diff --git a/crates/cargo-wdk/templates/kmdf/lib.rs.tmp b/crates/cargo-wdk/templates/kmdf/lib.rs.tmp index 3c1699a7b..6a6075faf 100644 --- a/crates/cargo-wdk/templates/kmdf/lib.rs.tmp +++ b/crates/cargo-wdk/templates/kmdf/lib.rs.tmp @@ -16,6 +16,8 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, diff --git a/crates/cargo-wdk/templates/umdf/lib.rs.tmp b/crates/cargo-wdk/templates/umdf/lib.rs.tmp index e610ad4cf..cd0931215 100644 --- a/crates/cargo-wdk/templates/umdf/lib.rs.tmp +++ b/crates/cargo-wdk/templates/umdf/lib.rs.tmp @@ -4,6 +4,8 @@ use wdk_sys::{ PCUNICODE_STRING, }; +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, diff --git a/crates/cargo-wdk/templates/wdm/lib.rs.tmp b/crates/cargo-wdk/templates/wdm/lib.rs.tmp index 3c1699a7b..6a6075faf 100644 --- a/crates/cargo-wdk/templates/wdm/lib.rs.tmp +++ b/crates/cargo-wdk/templates/wdm/lib.rs.tmp @@ -16,6 +16,8 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, diff --git a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/Cargo.lock b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/Cargo.lock index 147698235..f09928cc1 100644 --- a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/Cargo.lock +++ b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/Cargo.lock @@ -127,10 +127,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.17" +version = "1.2.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "e1d05d92f4b1fd76aad469d46cdd858ca761576082cd37df81416691e50199fb" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -145,9 +146,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clang-sys" @@ -250,6 +251,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0399f9d26e5191ce32c498bebd31e7a3ceabc2745f0ac54af3f335126c3f24b3" + [[package]] name = "fs4" version = "0.13.1" @@ -403,9 +410,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -555,9 +562,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", diff --git a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_1/src/lib.rs b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_1/src/lib.rs index 71623cce9..766cb5866 100644 --- a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_1/src/lib.rs +++ b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_1/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_2/src/lib.rs b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_2/src/lib.rs index 71623cce9..766cb5866 100644 --- a/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_2/src/lib.rs +++ b/crates/cargo-wdk/tests/emulated-workspace/umdf-driver-workspace/crates/driver_2/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/crates/cargo-wdk/tests/kmdf-driver/src/lib.rs b/crates/cargo-wdk/tests/kmdf-driver/src/lib.rs index 3c1699a7b..6a6075faf 100644 --- a/crates/cargo-wdk/tests/kmdf-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/kmdf-driver/src/lib.rs @@ -16,6 +16,8 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, diff --git a/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/Cargo.lock b/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/Cargo.lock index 9a0115c63..c013ff186 100644 --- a/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/Cargo.lock +++ b/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/Cargo.lock @@ -127,10 +127,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.17" +version = "1.2.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "e1d05d92f4b1fd76aad469d46cdd858ca761576082cd37df81416691e50199fb" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -145,9 +146,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clang-sys" @@ -243,6 +244,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0399f9d26e5191ce32c498bebd31e7a3ceabc2745f0ac54af3f335126c3f24b3" + [[package]] name = "fs4" version = "0.13.1" @@ -400,9 +407,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -552,9 +559,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", diff --git a/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs b/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs index 289d22f59..fae594cbc 100644 --- a/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs +++ b/crates/cargo-wdk/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs @@ -47,7 +47,9 @@ static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/crates/cargo-wdk/tests/new_command_test.rs b/crates/cargo-wdk/tests/new_command_test.rs index f551dfad7..2e6773281 100644 --- a/crates/cargo-wdk/tests/new_command_test.rs +++ b/crates/cargo-wdk/tests/new_command_test.rs @@ -3,7 +3,7 @@ mod test_utils; use std::path::PathBuf; use assert_cmd::Command; -use assert_fs::{assert::PathAssert, prelude::PathChild, TempDir}; +use assert_fs::{TempDir, assert::PathAssert, prelude::PathChild}; use mockall::PredicateBooleanExt; use test_utils::{set_crt_static_flag, with_file_lock}; @@ -60,12 +60,19 @@ fn help_works() { fn project_is_created(driver_type: &str) { let (stdout, _stderr) = with_file_lock(|| create_and_build_new_driver_project(driver_type)); - assert!(stdout - .contains("Required directive Provider missing, empty, or invalid in [Version] section.")); - assert!(stdout - .contains("Required directive Class missing, empty, or invalid in [Version] section.")); - assert!(stdout - .contains("Invalid ClassGuid \"\", expecting {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.")); + assert!( + stdout.contains( + "Required directive Provider missing, empty, or invalid in [Version] section." + ) + ); + assert!( + stdout + .contains("Required directive Class missing, empty, or invalid in [Version] section.") + ); + assert!( + stdout + .contains("Invalid ClassGuid \"\", expecting {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.") + ); assert!(stdout.contains("INF is NOT VALID")); } @@ -140,20 +147,26 @@ fn create_and_build_new_driver_project(driver_type: &str) -> (String, String) { assert!(tmp_dir.join(&driver_name).is_dir()); assert!(tmp_dir.join(&driver_name).join("build.rs").is_file()); assert!(tmp_dir.join(&driver_name).join("Cargo.toml").is_file()); - assert!(tmp_dir - .join(&driver_name) - .join(format!("{driver_name_underscored}.inx")) - .is_file()); - assert!(tmp_dir - .join(&driver_name) - .join("src") - .join("lib.rs") - .is_file()); - assert!(tmp_dir - .join(&driver_name) - .join(".cargo") - .join("config.toml") - .is_file()); + assert!( + tmp_dir + .join(&driver_name) + .join(format!("{driver_name_underscored}.inx")) + .is_file() + ); + assert!( + tmp_dir + .join(&driver_name) + .join("src") + .join("lib.rs") + .is_file() + ); + assert!( + tmp_dir + .join(&driver_name) + .join(".cargo") + .join("config.toml") + .is_file() + ); // assert content let driver_name_path = PathBuf::from(&driver_name); diff --git a/crates/cargo-wdk/tests/test_utils/mod.rs b/crates/cargo-wdk/tests/test_utils/mod.rs index e266d6d9f..dc8ed3cda 100644 --- a/crates/cargo-wdk/tests/test_utils/mod.rs +++ b/crates/cargo-wdk/tests/test_utils/mod.rs @@ -17,10 +17,10 @@ use fs4::fs_std::FileExt; pub fn set_crt_static_flag() { if let Ok(rustflags) = std::env::var("RUSTFLAGS") { let updated_rust_flags = format!("{rustflags} -C target-feature=+crt-static"); - std::env::set_var("RUSTFLAGS", updated_rust_flags); + set_var("RUSTFLAGS", updated_rust_flags); println!("RUSTFLAGS set, adding the +crt-static: {rustflags:?}"); } else { - std::env::set_var("RUSTFLAGS", "-C target-feature=+crt-static"); + set_var("RUSTFLAGS", "-C target-feature=+crt-static"); println!( "No RUSTFLAGS set, setting it to: {:?}", std::env::var("RUSTFLAGS").expect("RUSTFLAGS not set") @@ -87,9 +87,9 @@ where // Remove the env var if value is None if let Some(value) = value { - std::env::set_var(key, value); + set_var(key, value); } else { - std::env::remove_var(key); + remove_var(key); } } @@ -99,10 +99,10 @@ where for (key, _) in env_vars_key_value_pairs { original_env_vars.get(key).map_or_else( || { - std::env::remove_var(key); + remove_var(key); }, |value| { - std::env::set_var(key, value); + set_var(key, value); }, ); } @@ -110,3 +110,73 @@ where result }) } + +/// Safely sets an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::set_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[cfg(target_os = "windows")] +pub fn set_var(key: K, value: V) +where + K: AsRef, + V: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::set_var is always safe for windows targets + unsafe { + std::env::set_var(key, value); + } +} + +#[cfg(not(target_os = "windows"))] +pub fn set_var(_key: K, _value: V) +where + K: AsRef, + V: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} + +/// Safely removes an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::remove_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[allow(dead_code)] +#[cfg(target_os = "windows")] +pub fn remove_var(key: K) +where + K: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::remove_var is always safe for windows targets + unsafe { + std::env::remove_var(key); + } +} + +#[allow(dead_code)] +#[cfg(not(target_os = "windows"))] +pub fn remove_var(_key: K) +where + K: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} diff --git a/crates/cargo-wdk/tests/umdf-driver/src/lib.rs b/crates/cargo-wdk/tests/umdf-driver/src/lib.rs index 71623cce9..766cb5866 100644 --- a/crates/cargo-wdk/tests/umdf-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/umdf-driver/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs index 3c1699a7b..6a6075faf 100644 --- a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs @@ -16,6 +16,8 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, diff --git a/crates/wdk-alloc/src/lib.rs b/crates/wdk-alloc/src/lib.rs index b5abb5a78..779ba7a95 100644 --- a/crates/wdk-alloc/src/lib.rs +++ b/crates/wdk-alloc/src/lib.rs @@ -31,10 +31,10 @@ mod kernel_mode { use core::alloc::{GlobalAlloc, Layout}; use wdk_sys::{ - ntddk::{ExAllocatePool2, ExFreePool}, POOL_FLAG_NON_PAGED, SIZE_T, ULONG, + ntddk::{ExAllocatePool2, ExFreePool}, }; /// Allocator implementation to use with `#[global_allocator]` to allow use diff --git a/crates/wdk-build/rust-driver-makefile.toml b/crates/wdk-build/rust-driver-makefile.toml index a6e6fc0dc..4fa1bdba2 100644 --- a/crates/wdk-build/rust-driver-makefile.toml +++ b/crates/wdk-build/rust-driver-makefile.toml @@ -157,8 +157,18 @@ let serialized_wdk_metadata_map = wdk_build::metadata::to_map_with_prefix:: impl IntoIterator { }; if let Some(toolchain) = toolchain_arg { - env::set_var(CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN_ENV_VAR, toolchain); + set_var(CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN_ENV_VAR, toolchain); } CommandLineInterface::from_arg_matches_mut( @@ -671,7 +671,7 @@ pub fn setup_wdk_version() -> Result, ConfigErr }); } - env::set_var(WDK_VERSION_ENV_VAR, detected_sdk_version); + set_var(WDK_VERSION_ENV_VAR, detected_sdk_version); Ok([WDK_VERSION_ENV_VAR].map(ToString::to_string)) } @@ -699,8 +699,9 @@ pub fn setup_infverif_for_samples + ToString + ?Sized>( .parse::() .expect("Unable to parse the build number of the WDK version string as an int!"); let sample_flag = if version > MINIMUM_SAMPLES_FLAG_WDK_VERSION { - "/samples" // Note: Not currently implemented, so in samples TOML we - // currently skip infverif + // Note: Not currently implemented, so in samples TOML we currently skip + // infverif + "/samples" } else { "/msft" }; @@ -1155,7 +1156,7 @@ fn configure_wdf_build_output_dir(target_arg: Option<&String>, cargo_make_cargo_ output_dir }; - env::set_var( + set_var( WDK_BUILD_OUTPUT_DIRECTORY_ENV_VAR, wdk_build_output_directory, ); @@ -1172,7 +1173,7 @@ where let mut env_var_value: String = env::var(env_var_name).unwrap_or_default(); env_var_value.push(' '); env_var_value.push_str(string_to_append); - env::set_var(env_var_name, env_var_value.trim()); + set_var(env_var_name, env_var_value.trim()); } fn prepend_to_semicolon_delimited_env_var(env_var_name: S, string_to_prepend: T) @@ -1186,7 +1187,7 @@ where let mut env_var_value = string_to_prepend.to_string(); env_var_value.push(';'); env_var_value.push_str(env::var(env_var_name).unwrap_or_default().as_str()); - env::set_var(env_var_name, env_var_value); + set_var(env_var_name, env_var_value); } /// `cargo-make` condition script for `infverif` task in diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 2275a1ec5..eca5d787a 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -14,7 +14,7 @@ use std::{ env, fmt, - path::{absolute, Path, PathBuf}, + path::{Path, PathBuf, absolute}, str::FromStr, sync::LazyLock, }; @@ -794,7 +794,7 @@ impl Config { "--warn-=no-microsoft", ] .into_iter() - .map(std::string::ToString::to_string) + .map(ToString::to_string) } /// Returns a [`String`] iterator over all the headers for a given @@ -949,7 +949,7 @@ impl Config { "Usbpmapi.h", ] .iter() - .map(std::string::ToString::to_string), + .map(ToString::to_string), ); if matches!( self.driver_config, @@ -958,7 +958,7 @@ impl Config { headers.extend( ["usbbusif.h", "usbdlib.h", "usbfnattach.h", "usbfnioctl.h"] .iter() - .map(std::string::ToString::to_string), + .map(ToString::to_string), ); } @@ -981,7 +981,7 @@ impl Config { "urs/1.0/UrsCx.h", ] .iter() - .map(std::string::ToString::to_string), + .map(ToString::to_string), ); let latest_ucx_header_path = self.ucx_header()?; @@ -1385,7 +1385,7 @@ impl CpuArchitecture { #[tracing::instrument(level = "debug")] pub fn find_top_level_cargo_manifest() -> PathBuf { let out_dir = - PathBuf::from(std::env::var("OUT_DIR").expect( + PathBuf::from(env::var("OUT_DIR").expect( "Cargo should have set the OUT_DIR environment variable when executing build.rs", )); @@ -1552,6 +1552,7 @@ mod tests { use std::{collections::HashMap, ffi::OsStr, sync::Mutex}; use super::*; + use crate::utils::{remove_var, set_var}; mod two_part_version { use super::*; @@ -1787,14 +1788,14 @@ mod tests { // set requested environment variables for (key, value) in env_vars_key_value_pairs { - if let Ok(original_value) = std::env::var(key) { + if let Ok(original_value) = env::var(key) { let insert_result = original_env_vars.insert(key, original_value); assert!( insert_result.is_none(), "Duplicate environment variable keys were provided" ); } - std::env::set_var(key, value); + set_var(key, value); } let f_return_value = f(); @@ -1803,10 +1804,10 @@ mod tests { for (key, _) in env_vars_key_value_pairs { original_env_vars.get(key).map_or_else( || { - std::env::remove_var(key); + remove_var(key); }, |value| { - std::env::set_var(key, value); + set_var(key, value); }, ); } diff --git a/crates/wdk-build/src/metadata/map.rs b/crates/wdk-build/src/metadata/map.rs index 492b3ae3f..ad5a94bb4 100644 --- a/crates/wdk-build/src/metadata/map.rs +++ b/crates/wdk-build/src/metadata/map.rs @@ -2,7 +2,7 @@ // License: MIT OR Apache-2.0 use std::{ - collections::{btree_map, hash_map, BTreeMap, HashMap}, + collections::{BTreeMap, HashMap, btree_map, hash_map}, hash::{BuildHasher, Hash}, }; diff --git a/crates/wdk-build/src/metadata/mod.rs b/crates/wdk-build/src/metadata/mod.rs index 8dd01d4b2..03c363545 100644 --- a/crates/wdk-build/src/metadata/mod.rs +++ b/crates/wdk-build/src/metadata/mod.rs @@ -11,7 +11,7 @@ pub use error::{Error, Result}; pub use map::Map; -pub use ser::{to_map, to_map_with_prefix, Serializer}; +pub use ser::{Serializer, to_map, to_map_with_prefix}; pub(crate) mod ser; diff --git a/crates/wdk-build/src/metadata/ser.rs b/crates/wdk-build/src/metadata/ser.rs index 39b018b29..9f3f23715 100644 --- a/crates/wdk-build/src/metadata/ser.rs +++ b/crates/wdk-build/src/metadata/ser.rs @@ -2,8 +2,8 @@ // License: MIT OR Apache-2.0 use serde::{ - ser::{self, Impossible}, Serialize, + ser::{self, Impossible}, }; use super::{ @@ -31,9 +31,9 @@ pub const KEY_NAME_SEPARATOR: char = '-'; /// use std::collections::BTreeMap; /// /// use wdk_build::{ -/// metadata::{self, to_map}, /// DriverConfig, /// KmdfConfig, +/// metadata::{self, to_map}, /// }; /// /// let wdk_metadata = metadata::Wdk { @@ -78,9 +78,9 @@ where /// use std::collections::BTreeMap; /// /// use wdk_build::{ -/// metadata::{self, to_map_with_prefix}, /// DriverConfig, /// KmdfConfig, +/// metadata::{self, to_map_with_prefix}, /// }; /// /// let wdk_metadata = metadata::Wdk { @@ -587,7 +587,7 @@ mod tests { }; use super::*; - use crate::{metadata, DriverConfig, KmdfConfig, UmdfConfig}; + use crate::{DriverConfig, KmdfConfig, UmdfConfig, metadata}; #[test] fn test_kmdf() { diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 3f8424221..8daf17400 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -6,22 +6,22 @@ use std::{ env, - ffi::CStr, + ffi::{CStr, OsStr}, io, path::{Path, PathBuf}, }; use windows::{ - core::{s, PCSTR}, Win32::System::Registry::{ - RegCloseKey, - RegGetValueA, - RegOpenKeyExA, HKEY, HKEY_LOCAL_MACHINE, KEY_READ, RRF_RT_REG_SZ, + RegCloseKey, + RegGetValueA, + RegOpenKeyExA, }, + core::{PCSTR, s}, }; use crate::{ConfigError, CpuArchitecture, IoError, TwoPartVersion}; @@ -142,7 +142,7 @@ pub fn get_latest_windows_sdk_version(path_to_search: &Path) -> Result CpuArchitecture { - let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").expect( + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect( "Cargo should have set the CARGO_CFG_TARGET_ARCH environment variable when executing \ build.rs", ); @@ -350,17 +350,120 @@ pub fn find_max_version_in_directory>( }) } +/// Safely sets an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::set_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[cfg(target_os = "windows")] +pub fn set_var(key: K, value: V) +where + K: AsRef, + V: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::set_var is always safe for windows targets + unsafe { + env::set_var(key, value); + } +} + +#[cfg(not(target_os = "windows"))] +pub fn set_var(_key: K, _value: V) +where + K: AsRef, + V: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} + +/// Safely removes an environment variable. Will not compile if crate is not +/// targeted for Windows. +/// +/// This function provides a safe wrapper around [`std::env::remove_var`] that +/// became unsafe in Rust 2024 edition. +/// +/// # Panics +/// +/// This function may panic if key is empty, contains an ASCII equals sign '=' +/// or the NUL character '\0', or when value contains the NUL character. +#[allow(dead_code)] +#[cfg(target_os = "windows")] +pub fn remove_var(key: K) +where + K: AsRef, +{ + // SAFETY: this function is only conditionally compiled for windows targets, and + // env::remove_var is always safe for windows targets + unsafe { + env::remove_var(key); + } +} + +#[allow(dead_code)] +#[cfg(not(target_os = "windows"))] +pub fn remove_var(_key: K) +where + K: AsRef, +{ + compile_error!( + "windows-drivers-rs is designed to be run on a Windows host machine in a WDK environment. \ + Please build using a Windows target." + ); +} + #[cfg(test)] mod tests { use assert_fs::prelude::*; use super::*; + // Function with_clean_env clears the inputted environment variable and runs the + // closure + fn with_clean_env(key: &str, f: F) + where + F: FnOnce(), + { + let original = env::var(key).ok(); + + // SAFETY: We have verified that this is built for a Windows host due to no + // compile errors from building `set_var`. + unsafe { + env::remove_var(key); + } + + f(); + + if let Some(val) = &original { + // SAFETY: We have verified that this is built for a Windows host due to no + // compile errors from building `set_var`. + unsafe { + env::set_var(key, val); + } + } else { + // SAFETY: We have verified that this is built for a Windows host due to no + // compile errors from building `set_var`. + unsafe { + env::remove_var(key); + } + } + + assert!(env::var(key).ok() == original); + } + mod read_registry_key_string_value { use windows::Win32::UI::Shell::{ FOLDERID_ProgramFiles, - SHGetKnownFolderPath, KF_FLAG_DEFAULT, + SHGetKnownFolderPath, }; use super::*; @@ -584,11 +687,27 @@ mod tests { temp_dir.child("a.b").create_dir_all().unwrap(); // Invalid: non-numeric temp_dir.child("not_version").touch().unwrap(); // File: ignored temp_dir.child("3.0").touch().unwrap(); // File: ignored - // Should find the maximum among valid version directories only + // Should find the maximum among valid version directories only assert_eq!( find_max_version_in_directory(temp_dir.path()).unwrap(), TwoPartVersion(2, 0) ); } } + + #[cfg(target_os = "windows")] + mod safe_env_vars { + use super::*; + + #[test] + fn set_var_and_remove_var() { + let key = "WDK_BUILD_TEST_VAR"; + with_clean_env(key, || { + set_var(key, "test_value"); + assert_eq!(env::var(key).unwrap(), "test_value"); + remove_var(key); + assert!(env::var(key).is_err()); + }); + } + } } diff --git a/crates/wdk-sys/build.rs b/crates/wdk-sys/build.rs index e3172eee1..2a7308487 100644 --- a/crates/wdk-sys/build.rs +++ b/crates/wdk-sys/build.rs @@ -18,13 +18,12 @@ use std::{ use anyhow::Context; use bindgen::CodegenConfig; -use tracing::{info, info_span, trace, Span}; +use tracing::{Span, info, info_span, trace}; use tracing_subscriber::{ - filter::{LevelFilter, ParseError}, EnvFilter, + filter::{LevelFilter, ParseError}, }; use wdk_build::{ - configure_wdk_library_build_and_then, ApiSubset, BuilderExt, Config, @@ -33,6 +32,7 @@ use wdk_build::{ IoError, KmdfConfig, UmdfConfig, + configure_wdk_library_build_and_then, }; const OUT_DIR_PLACEHOLDER: &str = @@ -121,7 +121,9 @@ static TEST_STUBS_TEMPLATE: LazyLock = LazyLock::new(|| { use crate::WDFFUNC; /// Stubbed version of the symbol that `WdfFunctions` links to so that test targets will compile -#[no_mangle] +// SAFETY: Generated WDF symbol name is required for test compilation and is unique per build. +// No other symbols in this crate export this name, preventing linker conflicts. +#[unsafe(no_mangle)] pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null(); ", ) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 967fa7613..39a88977c 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -117,20 +117,26 @@ mod macros; // necessary due to LLVM being too eager to set it: it checks the LLVM IR for // floating point instructions - even if soft-float is enabled! #[allow(missing_docs)] -#[no_mangle] +// SAFETY: _fltused is a required Windows linker symbol for floating point support. +// No other symbols in this crate export this name, preventing linker conflicts. +#[unsafe(no_mangle)] pub static _fltused: () = (); // FIXME: Is there any way to avoid these stubs? See https://github.com/rust-lang/rust/issues/101134 #[cfg(panic = "abort")] #[allow(missing_docs)] -#[no_mangle] +// SAFETY: __CxxFrameHandler3 is a required Windows C++ exception handler symbol. +// No other symbols in this crate export this name, preventing linker conflicts. +#[unsafe(no_mangle)] pub const extern "system" fn __CxxFrameHandler3() -> i32 { 0 } #[cfg(panic = "abort")] #[allow(missing_docs)] -#[no_mangle] +// SAFETY: __CxxFrameHandler4 is a required Windows C++ exception handler symbol. +// No other symbols in this crate export this name, preventing linker conflicts. +#[unsafe(no_mangle)] pub const extern "system" fn __CxxFrameHandler4() -> i32 { // This is a stub for the C++ exception handling frame handler. It's never // called but it needs to be distinct from __CxxFrameHandler3 to not confuse @@ -140,7 +146,9 @@ pub const extern "system" fn __CxxFrameHandler4() -> i32 { #[cfg(panic = "abort")] #[allow(missing_docs)] -#[no_mangle] +// SAFETY: __GSHandlerCheck_EH4 is a required Windows C++ exception handler symbol. +// No other symbols in this crate export this name, preventing linker conflicts. +#[unsafe(no_mangle)] pub const extern "system" fn __GSHandlerCheck_EH4() -> i32 { // This is a stub for the C++ exception handling frame handler. It's never // called but it needs to be distinct from __CxxFrameHandler3 and diff --git a/crates/wdk-sys/src/test_stubs.rs b/crates/wdk-sys/src/test_stubs.rs index 03a6f9007..ff301dc38 100644 --- a/crates/wdk-sys/src/test_stubs.rs +++ b/crates/wdk-sys/src/test_stubs.rs @@ -27,7 +27,9 @@ use crate::{DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING}; driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF" ))] -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub const unsafe extern "system" fn driver_entry_stub( _driver: &mut DRIVER_OBJECT, _registry_path: PCUNICODE_STRING, @@ -41,7 +43,9 @@ mod wdf { /// Stubbed version of `WdfFunctionCount` Symbol so that test targets will /// compile - #[no_mangle] + // SAFETY: WdfFunctionCount is a required WDF symbol for test compilation. + // No other symbols in this crate export this name, preventing linker conflicts. + #[unsafe(no_mangle)] pub static mut WdfFunctionCount: ULONG = 0; include!(concat!(env!("OUT_DIR"), "/test_stubs.rs")); diff --git a/crates/wdk/src/print.rs b/crates/wdk/src/print.rs index bcbf26f82..5a0d1848f 100644 --- a/crates/wdk/src/print.rs +++ b/crates/wdk/src/print.rs @@ -90,7 +90,7 @@ pub fn _print(args: fmt::Arguments) { if #[cfg(any(driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF"))] { let mut buffered_writer = dbg_print_buf_writer::DbgPrintBufWriter::new(); - if let Ok(_) = fmt::write(&mut buffered_writer, args) { + if fmt::write(&mut buffered_writer, args).is_ok() { buffered_writer.flush(); } else { unreachable!("DbgPrintBufWriter should never fail to write"); @@ -235,11 +235,10 @@ mod dbg_print_buf_writer { // Helper function to advance the start of a `u8` slice to the next non-null // byte. Returns an empty slice if all bytes are null. fn advance_slice_to_next_non_null_byte(slice: &[u8]) -> &[u8] { - if let Some(pos) = slice.iter().position(|&b| b != b'\0') { - &slice[pos..] - } else { - &slice[slice.len()..] - } + slice + .iter() + .position(|&b| b != b'\0') + .map_or_else(|| &slice[slice.len()..], |pos| &slice[pos..]) } #[cfg(test)] @@ -273,7 +272,7 @@ mod dbg_print_buf_writer { // Check that the string is null-terminated at the end of the buffer. assert_eq!(writer.buffer[old_used], b'\0'); // Check that the string isn't null-terminated at the beginning of the buffer. - assert_ne!(writer.buffer[0], b'\0') + assert_ne!(writer.buffer[0], b'\0'); } #[test] @@ -352,8 +351,6 @@ mod dbg_print_buf_writer { characters long to ensure that the DbgPrintBufWriter's buffer overflow handling \ is thoroughly tested."; const TEST_STRING_LEN: usize = TEST_STRING.len(); - const UNFLUSHED_STRING_CONTENTS_STARTING_INDEX: usize = - TEST_STRING_LEN - (TEST_STRING_LEN % DbgPrintBufWriter::USABLE_BUFFER_SIZE); const { assert!( @@ -362,9 +359,6 @@ mod dbg_print_buf_writer { ); } - let expected_unflushed_string_contents = - &TEST_STRING[UNFLUSHED_STRING_CONTENTS_STARTING_INDEX..]; - let mut writer = DbgPrintBufWriter::new(); // set the last byte to 1 to ensure that the buffer is not automatically diff --git a/crates/wdk/src/wdf/spinlock.rs b/crates/wdk/src/wdf/spinlock.rs index 01785ff79..3334e3c8b 100644 --- a/crates/wdk/src/wdf/spinlock.rs +++ b/crates/wdk/src/wdf/spinlock.rs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 -use wdk_sys::{call_unsafe_wdf_function_binding, NTSTATUS, WDFSPINLOCK, WDF_OBJECT_ATTRIBUTES}; +use wdk_sys::{NTSTATUS, WDF_OBJECT_ATTRIBUTES, WDFSPINLOCK, call_unsafe_wdf_function_binding}; use crate::nt_success; @@ -42,7 +42,7 @@ impl SpinLock { nt_status = call_unsafe_wdf_function_binding!( WdfSpinLockCreate, attributes, - &mut spin_lock.wdf_spin_lock, + &mut spin_lock.wdf_spin_lock as *mut _, ); } nt_success(nt_status).then_some(spin_lock).ok_or(nt_status) diff --git a/crates/wdk/src/wdf/timer.rs b/crates/wdk/src/wdf/timer.rs index 83acaddc0..868533501 100644 --- a/crates/wdk/src/wdf/timer.rs +++ b/crates/wdk/src/wdf/timer.rs @@ -2,11 +2,11 @@ // License: MIT OR Apache-2.0 use wdk_sys::{ - call_unsafe_wdf_function_binding, NTSTATUS, - WDFTIMER, WDF_OBJECT_ATTRIBUTES, WDF_TIMER_CONFIG, + WDFTIMER, + call_unsafe_wdf_function_binding, }; use crate::nt_success; @@ -40,7 +40,7 @@ impl Timer { WdfTimerCreate, timer_config, attributes, - &mut timer.wdf_timer, + &mut timer.wdf_timer as *mut WDFTIMER, ); } nt_success(nt_status).then_some(timer).ok_or(nt_status) diff --git a/examples/sample-kmdf-driver/Cargo.lock b/examples/sample-kmdf-driver/Cargo.lock index 50c5165d6..1ca15cd6e 100644 --- a/examples/sample-kmdf-driver/Cargo.lock +++ b/examples/sample-kmdf-driver/Cargo.lock @@ -386,9 +386,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] diff --git a/examples/sample-kmdf-driver/src/lib.rs b/examples/sample-kmdf-driver/src/lib.rs index 050013455..f7dc197f1 100644 --- a/examples/sample-kmdf-driver/src/lib.rs +++ b/examples/sample-kmdf-driver/src/lib.rs @@ -51,7 +51,9 @@ static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/examples/sample-umdf-driver/Cargo.lock b/examples/sample-umdf-driver/Cargo.lock index 8e3e467d3..70c111dca 100644 --- a/examples/sample-umdf-driver/Cargo.lock +++ b/examples/sample-umdf-driver/Cargo.lock @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] diff --git a/examples/sample-umdf-driver/src/lib.rs b/examples/sample-umdf-driver/src/lib.rs index 9c9968f42..63457ae27 100644 --- a/examples/sample-umdf-driver/src/lib.rs +++ b/examples/sample-umdf-driver/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/examples/sample-wdm-driver/Cargo.lock b/examples/sample-wdm-driver/Cargo.lock index 7d2f8d78f..500edbb2c 100644 --- a/examples/sample-wdm-driver/Cargo.lock +++ b/examples/sample-wdm-driver/Cargo.lock @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -554,9 +554,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", diff --git a/examples/sample-wdm-driver/src/lib.rs b/examples/sample-wdm-driver/src/lib.rs index fa7d3348d..5e690ac92 100644 --- a/examples/sample-wdm-driver/src/lib.rs +++ b/examples/sample-wdm-driver/src/lib.rs @@ -30,7 +30,9 @@ static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDM -#[export_name = "DriverEntry"] +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] pub unsafe extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/config-kmdf/Cargo.lock b/tests/config-kmdf/Cargo.lock index 8bd510f13..8403ad231 100644 --- a/tests/config-kmdf/Cargo.lock +++ b/tests/config-kmdf/Cargo.lock @@ -295,9 +295,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown", @@ -360,9 +360,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "macrotest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0597a8d49ceeea5845b12d1970aa993261e68d4660b327eabab667b3e7ffd60" +checksum = "1bf02346400dec0d7e4af0aa787c28acf174ce54a9c77f6507a1ee62e2aa2ca2" dependencies = [ "diff", "fastrand", @@ -372,7 +372,7 @@ dependencies = [ "serde_derive", "serde_json", "syn", - "toml_edit", + "toml 0.9.7", ] [[package]] @@ -463,9 +463,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -556,18 +556,28 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -595,6 +605,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +dependencies = [ + "serde_core", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -624,9 +643,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.102" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -685,11 +704,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", - "serde_spanned", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_edit", ] +[[package]] +name = "toml" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.2", + "toml_datetime 0.7.2", + "toml_parser", + "toml_writer", + "winnow", +] + [[package]] name = "toml_datetime" version = "0.6.11" @@ -699,6 +733,15 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.22.27" @@ -707,18 +750,33 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", - "serde_spanned", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_write", "winnow", ] +[[package]] +name = "toml_parser" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +dependencies = [ + "winnow", +] + [[package]] name = "toml_write" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "toml_writer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" + [[package]] name = "tracing" version = "0.1.41" @@ -792,7 +850,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml", + "toml 0.8.23", ] [[package]] @@ -1038,9 +1096,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] diff --git a/tests/config-umdf/Cargo.lock b/tests/config-umdf/Cargo.lock index f50256cc8..9be508fcf 100644 --- a/tests/config-umdf/Cargo.lock +++ b/tests/config-umdf/Cargo.lock @@ -295,9 +295,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown", @@ -360,9 +360,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "macrotest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0597a8d49ceeea5845b12d1970aa993261e68d4660b327eabab667b3e7ffd60" +checksum = "1bf02346400dec0d7e4af0aa787c28acf174ce54a9c77f6507a1ee62e2aa2ca2" dependencies = [ "diff", "fastrand", @@ -372,7 +372,7 @@ dependencies = [ "serde_derive", "serde_json", "syn", - "toml_edit", + "toml 0.9.7", ] [[package]] @@ -463,9 +463,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -556,18 +556,28 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -595,6 +605,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +dependencies = [ + "serde_core", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -624,9 +643,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.102" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -685,11 +704,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", - "serde_spanned", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_edit", ] +[[package]] +name = "toml" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.2", + "toml_datetime 0.7.2", + "toml_parser", + "toml_writer", + "winnow", +] + [[package]] name = "toml_datetime" version = "0.6.11" @@ -699,6 +733,15 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.22.27" @@ -707,18 +750,33 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", - "serde_spanned", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_write", "winnow", ] +[[package]] +name = "toml_parser" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +dependencies = [ + "winnow", +] + [[package]] name = "toml_write" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "toml_writer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" + [[package]] name = "tracing" version = "0.1.41" @@ -792,7 +850,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml", + "toml 0.8.23", ] [[package]] @@ -1038,9 +1096,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] diff --git a/tests/customized-config-toml-workspace/Cargo.lock b/tests/customized-config-toml-workspace/Cargo.lock index c7e63176b..b665c3efe 100644 --- a/tests/customized-config-toml-workspace/Cargo.lock +++ b/tests/customized-config-toml-workspace/Cargo.lock @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clang-sys" @@ -540,6 +540,7 @@ dependencies = [ "clap", "clap-cargo", "paste", + "regex", "rustversion", "semver", "serde", diff --git a/tests/mixed-package-kmdf-workspace/Cargo.lock b/tests/mixed-package-kmdf-workspace/Cargo.lock index 316f97075..acc906627 100644 --- a/tests/mixed-package-kmdf-workspace/Cargo.lock +++ b/tests/mixed-package-kmdf-workspace/Cargo.lock @@ -407,9 +407,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -559,9 +559,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.102" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", diff --git a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs index 1ea37391d..20b297dfd 100644 --- a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs +++ b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs @@ -51,7 +51,9 @@ static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/umdf-driver-workspace/Cargo.lock b/tests/umdf-driver-workspace/Cargo.lock index 2b7ced1d0..5e3048876 100644 --- a/tests/umdf-driver-workspace/Cargo.lock +++ b/tests/umdf-driver-workspace/Cargo.lock @@ -410,9 +410,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -562,9 +562,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.102" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", diff --git a/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs b/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs index dd498498c..8ab9ef442 100644 --- a/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs +++ b/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs b/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs index dd498498c..8ab9ef442 100644 --- a/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs +++ b/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs @@ -33,7 +33,9 @@ use wdk_sys::{ /// /// # Safety /// Function is unsafe since it dereferences raw pointers passed to it from WDF -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/inputs/macrotest/bug_unused_imports.rs b/tests/wdk-macros-tests/tests/inputs/macrotest/bug_unused_imports.rs index f31966413..784be3569 100644 --- a/tests/wdk-macros-tests/tests/inputs/macrotest/bug_unused_imports.rs +++ b/tests/wdk-macros-tests/tests/inputs/macrotest/bug_unused_imports.rs @@ -36,7 +36,9 @@ use wdk_sys::{ WDF_NO_OBJECT_ATTRIBUTES, }; -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/inputs/macrotest/wdf_driver_create.rs b/tests/wdk-macros-tests/tests/inputs/macrotest/wdf_driver_create.rs index 4b09d3535..ebdca79b2 100644 --- a/tests/wdk-macros-tests/tests/inputs/macrotest/wdf_driver_create.rs +++ b/tests/wdk-macros-tests/tests/inputs/macrotest/wdf_driver_create.rs @@ -2,8 +2,9 @@ // License: MIT OR Apache-2.0 #![no_main] #![deny(warnings)] - -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub extern "system" fn driver_entry( driver: wdk_sys::PDRIVER_OBJECT, registry_path: wdk_sys::PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_api_that_does_not_exist.rs b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_api_that_does_not_exist.rs index deb7c4f36..177818eb0 100644 --- a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_api_that_does_not_exist.rs +++ b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_api_that_does_not_exist.rs @@ -5,7 +5,9 @@ use wdk_sys::*; -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_missing_arg.rs b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_missing_arg.rs index fc8f46ce7..75ea68019 100644 --- a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_missing_arg.rs +++ b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_missing_arg.rs @@ -5,7 +5,9 @@ use wdk_sys::*; -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_wrong_arg_order.rs b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_wrong_arg_order.rs index f07cb6fbd..ffcca5e83 100644 --- a/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_wrong_arg_order.rs +++ b/tests/wdk-macros-tests/tests/inputs/trybuild/wdf_driver_create_wrong_arg_order.rs @@ -5,7 +5,9 @@ use wdk_sys::*; -#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry +// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points. +// No other function in this compilation unit exports this name, preventing symbol conflicts. +#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub extern "system" fn driver_entry( driver: &mut DRIVER_OBJECT, registry_path: PCUNICODE_STRING, diff --git a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs index fb3d47552..634a9719f 100644 --- a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs @@ -23,7 +23,7 @@ use wdk_sys::{ call_unsafe_wdf_function_binding, NTSTATUS, PCUNICODE_STRING, PDRIVER_OBJECT, ULONG, WDFDRIVER, WDF_DRIVER_CONFIG, WDF_NO_HANDLE, WDF_NO_OBJECT_ATTRIBUTES, }; -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs index 2f60cd9a4..0049301cf 100644 --- a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs @@ -1,6 +1,6 @@ #![no_main] #![deny(warnings)] -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: wdk_sys::PDRIVER_OBJECT, registry_path: wdk_sys::PCUNICODE_STRING, @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs index fb3d47552..634a9719f 100644 --- a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs @@ -23,7 +23,7 @@ use wdk_sys::{ call_unsafe_wdf_function_binding, NTSTATUS, PCUNICODE_STRING, PDRIVER_OBJECT, ULONG, WDFDRIVER, WDF_DRIVER_CONFIG, WDF_NO_HANDLE, WDF_NO_OBJECT_ATTRIBUTES, }; -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs index 2f60cd9a4..0049301cf 100644 --- a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs @@ -1,6 +1,6 @@ #![no_main] #![deny(warnings)] -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: wdk_sys::PDRIVER_OBJECT, registry_path: wdk_sys::PCUNICODE_STRING, @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs index fb3d47552..634a9719f 100644 --- a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs @@ -23,7 +23,7 @@ use wdk_sys::{ call_unsafe_wdf_function_binding, NTSTATUS, PCUNICODE_STRING, PDRIVER_OBJECT, ULONG, WDFDRIVER, WDF_DRIVER_CONFIG, WDF_NO_HANDLE, WDF_NO_OBJECT_ATTRIBUTES, }; -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: PDRIVER_OBJECT, registry_path: PCUNICODE_STRING, @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs index 2f60cd9a4..0049301cf 100644 --- a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs @@ -1,6 +1,6 @@ #![no_main] #![deny(warnings)] -#[export_name = "DriverEntry"] +#[unsafe(export_name = "DriverEntry")] pub extern "system" fn driver_entry( driver: wdk_sys::PDRIVER_OBJECT, registry_path: wdk_sys::PCUNICODE_STRING, @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None"), + format_args!("Option should never be None") ), ); }; diff --git a/tests/wdk-sys-tests/Cargo.lock b/tests/wdk-sys-tests/Cargo.lock index d3371ba37..7aa12d69b 100644 --- a/tests/wdk-sys-tests/Cargo.lock +++ b/tests/wdk-sys-tests/Cargo.lock @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -544,9 +544,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.102" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote",