This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [windows](https://redirect.github.com/microsoft/windows-rs) | dependencies | minor | `0.59.0` -> `0.61.0` | --- ### Release Notes <details> <summary>microsoft/windows-rs (windows)</summary> ### [`v0.61.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.61.0) [Compare Source](https://redirect.github.com/microsoft/windows-rs/compare/0.60.0...0.61.0) Major crate updates: - `windows` 0.59.0 - `windows-core` 0.59.0 - `windows-implement` 0.59.0 - `windows-interface` 0.59.0 - `windows-targets` 0.53.0 - `windows_i686_msvc` 0.53.0 - `windows_x86_64_msvc` 0.53.0 - `windows_aarch64_msvc` 0.53.0 - `windows_i686_gnu` 0.53.0 - `windows_x86_64_gnu` 0.53.0 - `windows_i686_gnullvm` 0.53.0 - `windows_x86_64_gnullvm` 0.53.0 - `windows_aarch64_gnullvm` 0.53.0 - `windows-bindgen` 0.59.0 - `windows-registry` 0.4.0 - `windows-result` 0.3.0 - `windows-strings` 0.3.0 - `cppwinrt` 0.2.0 Minor crate updates: - `windows-version` 0.1.2 Excluded: - `windows-sys` 0.59.0 Things to keep in mind: - The tag/release names no longer map directly to the crate versions, so to [find samples](https://redirect.github.com/microsoft/windows-rs/tree/master/crates/samples) for a particular release requires looking at [the releases](https://redirect.github.com/microsoft/windows-rs/releases) page and finding the release that most recently updated a particular crate. - The `windows-bindgen` crate includes the major code generation overhaul that brings many improvements - be sure to check out the PR description for more information. The resulting code gen depends on the new version of `windows-core` and its dependencies, unless you include the `--sys` option. [#​3359](https://redirect.github.com/microsoft/windows-rs/issues/3359) - The `cppwinrt` crate constitutes a major update due to streamlining the error handling. [#​3415](https://redirect.github.com/microsoft/windows-rs/issues/3415) - The `windows-registry`, `windows-strings,` and `windows-result` crates are also major version updates since they include small breaking changes. - The `windows-targets` crate finally receives a major version update, the first in over a year. This is due to [#​3359](https://redirect.github.com/microsoft/windows-rs/issues/3359) and [#​3342](https://redirect.github.com/microsoft/windows-rs/issues/3342) potentially introducing breaking changes. Although unlikely, these updates introduced sufficient changes that make it hard to ensure that the `windows-targets` libs don't break existing code. As we're updating `windows-targets` anyway, I took the liberty to bump the MSRV to 1.60 - to match the latest version of `windows-sys` - and remove the old but unused doc macro feature. Both remained for compatibility with very old dependents of the `windows-targets` crate. - The `windows-version` crate receives a minor update to update its dependency on the `windows-targets` crate. - Beyond these specifics, this update is the culmination of around 6 months worth of work on the `windows-rs` project. The biggest improvements comes from the new code generation engine, but many other improvements are now also available for production. This includes support for many new lints, warnings, and suggestions provided by the Rust toolchain; much smaller code gen thanks to deriving many more traits; more efficient code gen; major improvements to WinRT type system and implementation support; more robust and consistent error handling; stock collection and async support; improved support for class hierarchies; and much more! In addition to "what's changed" below, check out what's changed for notes for [0.60.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0) and [0.59.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.59.0) for additional changes that roll up to the crates published as part of this release. #### What's Changed - Remove improper_ctypes workaround by [@​ChrisDenton](https://redirect.github.com/ChrisDenton) in [https://github.com/microsoft/windows-rs/pull/3296](https://redirect.github.com/microsoft/windows-rs/pull/3296) - Bump rollup from 2.79.1 to 2.79.2 in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3299](https://redirect.github.com/microsoft/windows-rs/pull/3299) - Update jsonschema requirement from 0.20 to 0.21 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3301](https://redirect.github.com/microsoft/windows-rs/pull/3301) - Address Rust nightly compiler warnings by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3311](https://redirect.github.com/microsoft/windows-rs/pull/3311) - Update jsonschema requirement from 0.21 to 0.22 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3310](https://redirect.github.com/microsoft/windows-rs/pull/3310) - Update workflows to ignore paths on pull request by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3312](https://redirect.github.com/microsoft/windows-rs/pull/3312) - Fix remaining `std` references in `windows` and `windows-core` crates for `no_std` builds by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3317](https://redirect.github.com/microsoft/windows-rs/pull/3317) - Bump cookie and express in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3318](https://redirect.github.com/microsoft/windows-rs/pull/3318) - Fix nested struct sort order by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3321](https://redirect.github.com/microsoft/windows-rs/pull/3321) - Update jsonschema requirement from 0.22 to 0.23 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3323](https://redirect.github.com/microsoft/windows-rs/pull/3323) - Add `unwrap` helper for `NTSTATUS` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3324](https://redirect.github.com/microsoft/windows-rs/pull/3324) - Bump http-proxy-middleware from 2.0.6 to 2.0.7 in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3331](https://redirect.github.com/microsoft/windows-rs/pull/3331) - Remove "implement" feature by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3333](https://redirect.github.com/microsoft/windows-rs/pull/3333) - Update web workflow by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3344](https://redirect.github.com/microsoft/windows-rs/pull/3344) - Update Windows metadata by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3342](https://redirect.github.com/microsoft/windows-rs/pull/3342) - Bump cross-spawn from 7.0.3 to 7.0.6 in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3347](https://redirect.github.com/microsoft/windows-rs/pull/3347) - fix: remove use of std in windows-strings h! macro by [@​vthib](https://redirect.github.com/vthib) in [https://github.com/microsoft/windows-rs/pull/3356](https://redirect.github.com/microsoft/windows-rs/pull/3356) - Major `windows-bindgen` update by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3359](https://redirect.github.com/microsoft/windows-rs/pull/3359) - Harden reg-free class activation by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3365](https://redirect.github.com/microsoft/windows-rs/pull/3365) - Simpler bindings generation by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3367](https://redirect.github.com/microsoft/windows-rs/pull/3367) - `windows-bindgen` should generate `no_std` bindings by default by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3366](https://redirect.github.com/microsoft/windows-rs/pull/3366) - Prefer optional over convertible parameters by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3368](https://redirect.github.com/microsoft/windows-rs/pull/3368) - Remove unused extensions by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3369](https://redirect.github.com/microsoft/windows-rs/pull/3369) - Simpler code generation by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3370](https://redirect.github.com/microsoft/windows-rs/pull/3370) - Update dependencies by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3374](https://redirect.github.com/microsoft/windows-rs/pull/3374) - Simpler code gen for Boolean parameters by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3373](https://redirect.github.com/microsoft/windows-rs/pull/3373) - Remap `BOOLEAN` to `bool` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3376](https://redirect.github.com/microsoft/windows-rs/pull/3376) - Avoid generating `transmute` for input value type parameter bindings by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3377](https://redirect.github.com/microsoft/windows-rs/pull/3377) - Fix macro docs by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3378](https://redirect.github.com/microsoft/windows-rs/pull/3378) - Streamline error handling in `windows-bindgen` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3379](https://redirect.github.com/microsoft/windows-rs/pull/3379) - Improve WinRT event representation and testing by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3382](https://redirect.github.com/microsoft/windows-rs/pull/3382) - Use `track_caller` to make debugging `bindgen` build script errors easier by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3383](https://redirect.github.com/microsoft/windows-rs/pull/3383) - `windows-bindgen` now uses `Ref` and `OutRef` for COM interface traits by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3386](https://redirect.github.com/microsoft/windows-rs/pull/3386) - Add static event test/sample for WinRT by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3389](https://redirect.github.com/microsoft/windows-rs/pull/3389) - Verify param direction by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3390](https://redirect.github.com/microsoft/windows-rs/pull/3390) - Ensure external references to static factories are generated correctly by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3392](https://redirect.github.com/microsoft/windows-rs/pull/3392) - Update `windows-bindgen` to support `unsafe_op_in_unsafe_fn` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3393](https://redirect.github.com/microsoft/windows-rs/pull/3393) - Make `Ref` work with more than just interface types by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3394](https://redirect.github.com/microsoft/windows-rs/pull/3394) - Add PR preview deployments to web workflow by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3395](https://redirect.github.com/microsoft/windows-rs/pull/3395) - Adjust web workflow to use gh-pages branch by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3397](https://redirect.github.com/microsoft/windows-rs/pull/3397) - Streamline CRA deps and webpack config by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3396](https://redirect.github.com/microsoft/windows-rs/pull/3396) - Address nightly clippy warnings about operator precedence by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3414](https://redirect.github.com/microsoft/windows-rs/pull/3414) - Detect unsupported array parameters by [@​iancormac84](https://redirect.github.com/iancormac84) in [https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402) - `cppwinrt` should consistently panic on failure by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3415](https://redirect.github.com/microsoft/windows-rs/pull/3415) - Shorten sample crate names by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3416](https://redirect.github.com/microsoft/windows-rs/pull/3416) - Use `track_caller` to make debugging `cppwinrt` build script errors easier by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3417](https://redirect.github.com/microsoft/windows-rs/pull/3417) - Fix provenance in direct32 sample by [@​ChrisDenton](https://redirect.github.com/ChrisDenton) in [https://github.com/microsoft/windows-rs/pull/3419](https://redirect.github.com/microsoft/windows-rs/pull/3419) - Update web workflow to use external origin by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3420](https://redirect.github.com/microsoft/windows-rs/pull/3420) - Avoid `transmute` where possible by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3421](https://redirect.github.com/microsoft/windows-rs/pull/3421) - Update GitHub Actions runners by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3423](https://redirect.github.com/microsoft/windows-rs/pull/3423) - Improve feature search UX, add dark mode, and update deps by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3422](https://redirect.github.com/microsoft/windows-rs/pull/3422) - Release 0.61.0 by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3418](https://redirect.github.com/microsoft/windows-rs/pull/3418) #### New Contributors - [@​iancormac84](https://redirect.github.com/iancormac84) made their first contribution in [https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402) **Full Changelog**: https://github.com/microsoft/windows-rs/compare/0.60.0...0.61.0 ### [`v0.60.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0) [Compare Source](https://redirect.github.com/microsoft/windows-rs/compare/0.59.0...0.60.0) This release includes an update to the [windows-registry](https://crates.io/crates/windows-registry) and [windows-strings](https://crates.io/crates/windows-strings) crates, mainly to provide various improvements to registry support for [rustup](https://redirect.github.com/rust-lang/rustup). #### What's Changed - Add precise registry types and allocation-free queries and updates by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3184](https://redirect.github.com/microsoft/windows-rs/pull/3184) - Add registry `Value` to/from `HSTRING` conversion by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3190](https://redirect.github.com/microsoft/windows-rs/pull/3190) - Replace `From<&str>` for `GUID` with `TryFrom<&str>` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3193](https://redirect.github.com/microsoft/windows-rs/pull/3193) - Remove uneeded feature dependencies by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3201](https://redirect.github.com/microsoft/windows-rs/pull/3201) - docs: add root level documentation for all libraries by [@​Nerixyz](https://redirect.github.com/Nerixyz) in [https://github.com/microsoft/windows-rs/pull/3202](https://redirect.github.com/microsoft/windows-rs/pull/3202) - Cleanup doc testing by [@​Nerixyz](https://redirect.github.com/Nerixyz) in [https://github.com/microsoft/windows-rs/pull/3205](https://redirect.github.com/microsoft/windows-rs/pull/3205) - Revert cfg doc by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3206](https://redirect.github.com/microsoft/windows-rs/pull/3206) - Remove workaround for "unused" private fields by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3207](https://redirect.github.com/microsoft/windows-rs/pull/3207) - Immutable Event implementation by [@​lifers](https://redirect.github.com/lifers) in [https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198) - Always treat warnings as errors by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3210](https://redirect.github.com/microsoft/windows-rs/pull/3210) - Consistent allocation failure handling by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3209](https://redirect.github.com/microsoft/windows-rs/pull/3209) - Improve class hierarchy support by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3212](https://redirect.github.com/microsoft/windows-rs/pull/3212) - Consistent allocation failure for stock collections by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3216](https://redirect.github.com/microsoft/windows-rs/pull/3216) - Consistent allocation failure for `windows-registry` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3215](https://redirect.github.com/microsoft/windows-rs/pull/3215) - Add default "std" feature for `windows-registry` crate by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3214](https://redirect.github.com/microsoft/windows-rs/pull/3214) - Overhaul async and future support by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3213](https://redirect.github.com/microsoft/windows-rs/pull/3213) - Addressing new nightly Clippy warning by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3222](https://redirect.github.com/microsoft/windows-rs/pull/3222) - Add async `ready` support by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3221](https://redirect.github.com/microsoft/windows-rs/pull/3221) - Bump micromatch from 4.0.5 to 4.0.8 in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3223](https://redirect.github.com/microsoft/windows-rs/pull/3223) - Add file dialog sample by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3226](https://redirect.github.com/microsoft/windows-rs/pull/3226) - Use relative path for extension by [@​glandium](https://redirect.github.com/glandium) in [https://github.com/microsoft/windows-rs/pull/3224](https://redirect.github.com/microsoft/windows-rs/pull/3224) - Simplify trait bounds for interface implementations by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3227](https://redirect.github.com/microsoft/windows-rs/pull/3227) - Remove unnecessary closure from generated code by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3228](https://redirect.github.com/microsoft/windows-rs/pull/3228) - Bump webpack from 5.90.2 to 5.94.0 in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3236](https://redirect.github.com/microsoft/windows-rs/pull/3236) - Add async `spawn` support by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3235](https://redirect.github.com/microsoft/windows-rs/pull/3235) - Nightly Clippy warning about assumed lifetime by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3243](https://redirect.github.com/microsoft/windows-rs/pull/3243) - Regenerate GNU libs by [@​riverar](https://redirect.github.com/riverar) in [https://github.com/microsoft/windows-rs/pull/3241](https://redirect.github.com/microsoft/windows-rs/pull/3241) - Add support for composable constructors by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3246](https://redirect.github.com/microsoft/windows-rs/pull/3246) - Use workspace dependencies where practical by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3248](https://redirect.github.com/microsoft/windows-rs/pull/3248) - Add test folders by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3252](https://redirect.github.com/microsoft/windows-rs/pull/3252) - Improve interop testing by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3253](https://redirect.github.com/microsoft/windows-rs/pull/3253) - Avoid deriving `Eq` for structs containing floating point type parameters by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3255](https://redirect.github.com/microsoft/windows-rs/pull/3255) - Add test for composable type authoring support by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3259](https://redirect.github.com/microsoft/windows-rs/pull/3259) - Factory cache statics don't need to be public by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3261](https://redirect.github.com/microsoft/windows-rs/pull/3261) - Allow `noexcept` methods in a composable hierarchy by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3262](https://redirect.github.com/microsoft/windows-rs/pull/3262) - Group more of the WinRT tests together by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3263](https://redirect.github.com/microsoft/windows-rs/pull/3263) - Remove "riddle" and metadata generation by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3266](https://redirect.github.com/microsoft/windows-rs/pull/3266) - Improvements to `windows-metadata` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3268](https://redirect.github.com/microsoft/windows-rs/pull/3268) - We can now derive `Eq` and `PartialEq` for structs containing callbacks by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3270](https://redirect.github.com/microsoft/windows-rs/pull/3270) - Simpler "retval" heuristic by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3271](https://redirect.github.com/microsoft/windows-rs/pull/3271) - Test error handling for `windows-bindgen` crate by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3272](https://redirect.github.com/microsoft/windows-rs/pull/3272) - Exclude `web` on most workflows by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3279](https://redirect.github.com/microsoft/windows-rs/pull/3279) - Bump serve-static and express in /web/features by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3274](https://redirect.github.com/microsoft/windows-rs/pull/3274) - Update jsonschema requirement from 0.18 to 0.19 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/microsoft/windows-rs/pull/3283](https://redirect.github.com/microsoft/windows-rs/pull/3283) - Move `VARIANT` support to the `windows` crate by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3282](https://redirect.github.com/microsoft/windows-rs/pull/3282) - Update `jsonschema` dependency by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3286](https://redirect.github.com/microsoft/windows-rs/pull/3286) - Expand `raw-dylib` testing by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3287](https://redirect.github.com/microsoft/windows-rs/pull/3287) - Fix for `cppwinrt` concurrency issue by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3289](https://redirect.github.com/microsoft/windows-rs/pull/3289) - Address Rust nightly compiler warnings by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3292](https://redirect.github.com/microsoft/windows-rs/pull/3292) - Add `Deref` implementation for `HSTRING` by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3291](https://redirect.github.com/microsoft/windows-rs/pull/3291) - Release 0.60.0 by [@​kennykerr](https://redirect.github.com/kennykerr) in [https://github.com/microsoft/windows-rs/pull/3293](https://redirect.github.com/microsoft/windows-rs/pull/3293) #### New Contributors - [@​lifers](https://redirect.github.com/lifers) made their first contribution in [https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198) **Full Changelog**: https://github.com/microsoft/windows-rs/compare/0.59.0...0.60.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/astral-sh/uv). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI1Ny4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: konstin <konstin@mailbox.org>
Windows trampolines
This is a fork of posy trampolines.
Building
Cross-compiling from Linux
Install cargo xwin. Use your package manager to install
LLD and add the rustup targets:
sudo apt install llvm clang lld
cargo install cargo-xwin
rustup toolchain install nightly-2025-02-16
rustup component add rust-src --toolchain nightly-2025-02-16-x86_64-unknown-linux-gnu
rustup target add --toolchain nightly-2025-02-16 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-02-16 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-02-16 aarch64-pc-windows-msvc
Then, build the trampolines for all supported architectures:
cargo +nightly-2025-02-16 xwin build --xwin-arch x86 --release --target i686-pc-windows-msvc
cargo +nightly-2025-02-16 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-02-16 xwin build --release --target aarch64-pc-windows-msvc
Cross-compiling from macOS
Install cargo xwin. Use your package manager to install
LLVM and add the rustup targets:
brew install llvm
cargo install cargo-xwin
rustup toolchain install nightly-2025-02-16
rustup component add rust-src --toolchain nightly-2025-02-16-aarch64-apple-darwin
rustup target add --toolchain nightly-2025-02-16 i686-pc-windows-msvc
rustup target add --toolchain nightly-2025-02-16 x86_64-pc-windows-msvc
rustup target add --toolchain nightly-2025-02-16 aarch64-pc-windows-msvc
Then, build the trampolines for all supported architectures:
cargo +nightly-2025-02-16 xwin build --release --target i686-pc-windows-msvc
cargo +nightly-2025-02-16 xwin build --release --target x86_64-pc-windows-msvc
cargo +nightly-2025-02-16 xwin build --release --target aarch64-pc-windows-msvc
Updating the prebuilt executables
After building the trampolines for all supported architectures:
cp target/aarch64-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/uv-trampoline-aarch64-console.exe
cp target/aarch64-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-aarch64-gui.exe
cp target/x86_64-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/uv-trampoline-x86_64-console.exe
cp target/x86_64-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-x86_64-gui.exe
cp target/i686-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/uv-trampoline-i686-console.exe
cp target/i686-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-i686-gui.exe
Testing the trampolines
To perform a basic smoke test of the trampolines, run the following commands on a Windows machine, from the root of the repository:
cargo clean
cargo run venv
cargo run pip install black
.venv\Scripts\black --version
Background
What is this?
Sometimes you want to run a tool on Windows that's written in Python, like black or mypy or
jupyter or whatever. But, Windows does not know how to run Python files! It knows how to run
.exe files. So we need to somehow convert our Python file a .exe file.
That's what this does: it's a generic "trampoline" that lets us generate custom .exes for
arbitrary Python scripts, and when invoked it bounces to invoking python <the script> instead.
How do you use it?
Basically, this looks up python.exe (for console programs) and invokes
python.exe path\to\the\<the .exe>.
The intended use is:
- take your Python script, name it
__main__.py, and pack it into a.zipfile. Then concatenate that.zipfile onto the end of one of our prebuilt.exes. - After the zip file content, write the path to the Python executable that the script uses to run the Python script as UTF-8 encoded string, followed by the path's length as a 32-bit little-endian integer.
- At the very end, write the magic number
UVUVin bytes.
launcher.exe |
|---|
<zipped python script> |
<path to python.exe> |
<len(path to python.exe)> |
<b'U', b'V', b'U', b'V'> |
Then when you run python on the .exe, it will see the .zip trailer at the end of the .exe,
and automagically look inside to find and execute __main__.py. Easy-peasy.
Why does this exist?
I probably could have used Vinay's C++ implementation from distlib, but what's the fun in that? In
particular, optimizing for binary size was entertaining (these are ~7x smaller than the distlib,
which doesn't matter much, but does a little bit, considering that it gets added to every Python
script). There are also some minor advantages, like I think the Rust code is easier to understand
(multiple files!) and it's convenient to be able to straightforwardly code the Python-finding logic
we want. But mostly it was just an interesting challenge.
This does owe a lot to the distlib implementation though. The overall logic is copied
more-or-less directly.
Anything I should know for hacking on this?
In order to minimize binary size, this uses, panic="abort", and carefully avoids using
core::fmt. This removes a bunch of runtime overhead: by default, Rust "hello world" on Windows is
~150 KB! So these binaries are ~10x smaller.
Of course the tradeoff is that this is an awkward super-limited environment. No C runtime and limited platform APIs... you don't even panicking support by default. To work around this:
-
We use
windowsto access Win32 APIs directly. Who needs a C runtime? Though uh, this does mean that literally all of our code isunsafe. Sorry! -
diagnostics.rsusesufmtand some cute Windows tricks to get a convenient version ofeprintln!that works withoutcore::fmt, and automatically prints to either the console if available or pops up a message box if not. -
All the meat is in
bounce.rs.
Miscellaneous tips:
-
cargo-bloatis a useful tool for checking what code is ending up in the final binary and how much space it's taking. (It makes it very obvious whether you've pulled incore::fmt!) -
Lots of Rust built-in panicking checks will pull in
core::fmt, e.g., if you ever use.unwrap()then suddenly our binaries double in size, because theif foo.is_none() { panic!(...) }that's hidden inside.unwrap()will invokecore::fmt, even if the unwrap will actually never fail..unwrap_unchecked()avoids this. Similar forslice[idx]vsslice.get_unchecked(idx).
How do you build this stupid thing?
Building this can be frustrating, because the low-level compiler/runtime machinery have a bunch of
implicit assumptions about the environment they'll run in, and the facilities it provides for things
like memcpy, unwinding, etc. So we need to replace the bits that we actually need, and which bits
we need can change depending on stuff like optimization options. For example: we use
panic="abort", so we don't actually need unwinding support, but at lower optimization levels the
compiler might not realize that, and still emit references to the unwinding
helper__CxxFrameHandler3. And then the linker blows up because that symbol doesn't exist.
cargo build --release --target i686-pc-windows-msvc
cargo build --release --target x86_64-pc-windows-msvc
cargo build --release --target aarch64-pc-windows-msvc