Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "strict_asserts" feature in wgpu-core. #2872

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Jul 12, 2022

Since wgpu-core's public functions are supposed to validate their
parameters, the internal track module skips many of Rust's usual
run-time checks in release builds. However, some wgpu-core users
are happy to pay the performance cost in exchange for more safety.
The "tracker_asserts" feature causes the track module to perform
the same checks in release builds as it does in debug builds.

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories

Description
Describe what problem this is solving, and how it's solved.

Testing
Explain how this change is tested.

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Comment on naming and what part of the codebase it is for - but the code is fine.

wgpu-core/Cargo.toml Outdated Show resolved Hide resolved
wgpu-core/src/track/assertions.rs Outdated Show resolved Hide resolved
Since `wgpu-core`'s public functions are supposed to validate their
parameters, the internal `track` module skips many of Rust's usual
run-time checks in release builds. However, some `wgpu-core` users are
happy to pay the performance cost in exchange for more safety. The
`"strict_asserts"` feature causes `wgpu_core` to perform the same
checks in release builds as it does in debug builds.
@jimblandy
Copy link
Member Author

I changed the name of the feature and macros to 'strict_assert'.

@jimblandy jimblandy changed the title Implement "tracker_asserts" feature in wgpu-core. Implement "strict_asserts" feature in wgpu-core. Aug 7, 2022
@cwfitzgerald cwfitzgerald merged commit d655017 into gfx-rs:master Aug 8, 2022
@jimblandy jimblandy deleted the tracker_asserts branch August 14, 2022 07:32
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.

2 participants