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

Add static assertions to bevy_utils for compile-time checks #11182

Merged
merged 5 commits into from
Jan 2, 2024

Conversation

cBournhonesque
Copy link
Contributor

@cBournhonesque cBournhonesque commented Jan 2, 2024

Objective

  • We want to use static_assertions to perform precise compile time checks at testing time. In this PR, we add those checks to make sure that EntityHashMap and PreHashMap are Clone (and we replace the more clumsy previous tests)
  • Fixes Use static_assertions for compilation tests #11181

(will need to be rebased once #11178 is merged)

@cBournhonesque cBournhonesque added C-Code-Quality A section of code that is hard to understand or change C-Testing A change that impacts how we test Bevy or how users test their apps labels Jan 2, 2024
crates/bevy_utils/src/lib.rs Outdated Show resolved Hide resolved
@james7132 james7132 added this pull request to the merge queue Jan 2, 2024
Merged via the queue into bevyengine:main with commit 0275508 Jan 2, 2024
26 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
# Objective

- Tests are manually checking whether derived types implement certain
traits. (Specifically in `bevy_reflect.)
- #11182 introduces
[`static_assertions`](https://docs.rs/static_assertions/) to
automatically check this.
- Simplifies `Reflect` test in #11195.
- Closes #11196.

## Solution

- Add `static_assertions` and replace current tests.

---

I wasn't sure whether to remove the existing test or not. What do you
think?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Testing A change that impacts how we test Bevy or how users test their apps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use static_assertions for compilation tests
4 participants