Skip to content

Fix debug assertion not covering both parts of the debug statement - #9352

Merged
ErichDonGubler merged 1 commit into
gfx-rs:trunkfrom
Elabajaba:fix_debug_assert
Apr 2, 2026
Merged

Fix debug assertion not covering both parts of the debug statement#9352
ErichDonGubler merged 1 commit into
gfx-rs:trunkfrom
Elabajaba:fix_debug_assert

Conversation

@Elabajaba

@Elabajaba Elabajaba commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Description
Trivial fix to make wgpu build again when debug_assertions aren't enabled

Testing
cargo build --release now works

@kristoff3r kristoff3r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops, sorry about that. I was sure that debug_assert_eq would disappear completely on release, but apparently not.

@cwfitzgerald cwfitzgerald self-assigned this Apr 1, 2026

@ErichDonGubler ErichDonGubler 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.

Ack, thanks!

@ErichDonGubler
ErichDonGubler merged commit e8afd9a into gfx-rs:trunk Apr 2, 2026
58 checks passed
@ErichDonGubler ErichDonGubler added the type: bug Something isn't working label Apr 2, 2026
@jimblandy

Copy link
Copy Markdown
Member

Oops, sorry about that. I was sure that debug_assert_eq would disappear completely on release, but apparently not.

Yeah, the key detail is this bit, from the debug_assert_eq! documentation:

The result of expanding debug_assert_eq! is always type checked.

So even when not(debug_assertions), the macro expansion still includes the expressions, just not in such a way that they'll be evaluated. This is to prevent mistakes symmetrical to the one here, in which users who are in the habit of doing release builds don't notice that their assertions are garbage until they happen to do a debug build.

@Elabajaba
Elabajaba deleted the fix_debug_assert branch May 3, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants