wine crates: narrow unsafe blocks for the rustc lint #102

Manually merged
github merged 2 commits from github-bot/gh-102 into gh-pr/102/base 2026-12-01 14:08:24 +00:00 AGit
Owner

@⁠TheRifai on GitHub · 2026-12-01 13:49 UTC · original
TheRifai:wine-unsafe-narrow → main · +26 −11 · 3 files · 2 commits · merged 2026-12-01 14:07 UTC

What

The three wine crates (umem-pe, umem-unix, vkback-unix) now deny unsafe_op_in_unsafe_fn (docs/TASKS.md “The root workspace's rustc lints everywhere”, issue #41). Following the review that rejected the whole-function wraps, every unsafe operation inside an unsafe fn has its own narrow unsafe { … } block with a // SAFETY: note about that operation. The existing /// # Safety caller contracts on umem_init and umem_call are kept.

The reference

The root Cargo.toml's rustc lint table is the policy source; this is the wine-crates step after umem.

Evidence

  • cargo check --workspace --all-targets --locked in greenfield/wine/ and tools/build.sh pass with the deny in place.
  • Native cargo test of umem-pe cannot link kernel32 on Linux (pre-existing: that crate is built for Windows with xwin in CI), so compile checks are the gate here.

Checklist (docs/AGENTS.md)

  • One topic; docs/TASKS.md not edited (rule 29/31)
  • No fallback added (rule 33)
  • No constants or switches added (rules 2/9b)
  • No queues changed (rule 35)
  • Narrow unsafe blocks with specific SAFETY notes; caller contracts in /// # Safety (rule 36)
  • Check and build pass; no translator output change (rule 27)
  • Comments say what is true now (rule 3)
  • Nothing from the title, no non-free data pointers (hard constraints)
**@⁠TheRifai** on GitHub · 2026-12-01 13:49 UTC · [original](https://github.com/vktory6/VKtory/pull/102) `TheRifai:wine-unsafe-narrow` → `main` · +26 −11 · 3 files · 2 commits · merged 2026-12-01 14:07 UTC ## What The three wine crates (`umem-pe`, `umem-unix`, `vkback-unix`) now deny `unsafe_op_in_unsafe_fn` (docs/TASKS.md “The root workspace's rustc lints everywhere”, issue #41). Following the review that rejected the whole-function wraps, every unsafe operation inside an `unsafe fn` has its own narrow `unsafe { … }` block with a `// SAFETY:` note about that operation. The existing `/// # Safety` caller contracts on `umem_init` and `umem_call` are kept. ## The reference The root Cargo.toml's rustc lint table is the policy source; this is the wine-crates step after umem. ## Evidence - `cargo check --workspace --all-targets --locked` in `greenfield/wine/` and `tools/build.sh` pass with the deny in place. - Native `cargo test` of `umem-pe` cannot link `kernel32` on Linux (pre-existing: that crate is built for Windows with xwin in CI), so compile checks are the gate here. ## Checklist (docs/AGENTS.md) - [x] One topic; `docs/TASKS.md` not edited (rule 29/31) - [x] No fallback added (rule 33) - [x] No constants or switches added (rules 2/9b) - [x] No queues changed (rule 35) - [x] Narrow unsafe blocks with specific SAFETY notes; caller contracts in `/// # Safety` (rule 36) - [x] Check and build pass; no translator output change (rule 27) - [x] Comments say what is true now (rule 3) - [x] Nothing from the title, no non-free data pointers (hard constraints)
Same rework as umem (#41): the three wine crates deny the lint and every unsafe
operation inside an unsafe fn has its own narrow block with an operation-specific
SAFETY note; the caller contracts stay in `/// # Safety` sections. cargo check
and tools/build.sh pass (native umem-pe tests cannot link kernel32 here, as
before; CI builds that crate with xwin).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:52:23 +00:00
github-bot changed target branch from main to gh-pr/102/base 2026-12-01 14:08:23 +00:00
github manually merged commit 75fd8bfd71 into gh-pr/102/base 2026-12-01 14:08:24 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 14:07 UTC · original

Merged as 5932bf9, thanks! One real fix on my side: in umem-pe's umem_init the literal "\\??\\Z:" had become "\\\\??\\Z:", which turns the NT prefix \??\Z: into \\??\Z: and breaks loading the Unix library. Nothing in the build or the tests runs that path, only a game start would have shown it, so it's worth a careful look when a mechanical rewrite touches string literals. The first SAFETY note also said kernel32 where the call is for ntdll.

**@⁠vktory6** on GitHub · 2026-12-01 14:07 UTC · [original](https://github.com/vktory6/VKtory/pull/102#issuecomment-7313744240) Merged as 5932bf9, thanks! One real fix on my side: in `umem-pe`'s `umem_init` the literal `"\\??\\Z:"` had become `"\\\\??\\Z:"`, which turns the NT prefix `\??\Z:` into `\\??\Z:` and breaks loading the Unix library. Nothing in the build or the tests runs that path, only a game start would have shown it, so it's worth a careful look when a mechanical rewrite touches string literals. The first SAFETY note also said kernel32 where the call is for ntdll.
This discussion has been locked. Commenting is limited to contributors.
No description provided.