Skip to content

Prevent deserializing or defaulting LoadOp::DontCare, for soundness.#9428

Merged
cwfitzgerald merged 1 commit into
gfx-rs:trunkfrom
kpreid:dontcare
Apr 15, 2026
Merged

Prevent deserializing or defaulting LoadOp::DontCare, for soundness.#9428
cwfitzgerald merged 1 commit into
gfx-rs:trunkfrom
kpreid:dontcare

Conversation

@kpreid

@kpreid kpreid commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Connections
Fixes #8780.

Description
Removes derive(Default) from the LoadOpDontCare token, and applies the #[serde::skip] attribute to the variant DontCare. This means it is not possible to create DontCare without an unsafe block, as was intended. Attempted deserializing is an error.

If in the future we resurrect the wgpu trace/player functionality and want to be able to intentionally deserialize DontCare, we can refine this later as a non-breaking change.

Testing
Added static assertions.

Squash or Rebase?
Rebase

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

This means it is not possible to create `DontCare` without an unsafe
block, as was intended.

Putting `serde::skip` on the variant means that the variant cannot be
deserialized — it is an error to do so.

If in the future we resurrect the wgpu trace/player functionality and
want to be able to intentionally deserialize `DontCare`, we can refine
this later as a non-breaking change.

@cwfitzgerald cwfitzgerald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@cwfitzgerald cwfitzgerald merged commit 0b4bdaf into gfx-rs:trunk Apr 15, 2026
59 checks passed
@kpreid kpreid deleted the dontcare branch April 15, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoadOpDontCare should not implement Default

2 participants