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

Unsoundness in Entry methods #40

Closed
Anders429 opened this issue Jan 31, 2022 · 0 comments · Fixed by #50
Closed

Unsoundness in Entry methods #40

Anders429 opened this issue Jan 31, 2022 · 0 comments · Fixed by #50
Labels
C - Bug Category: Something is not functioning as expected.

Comments

@Anders429
Copy link
Owner

Entry::add() and Entry::remove() both currently assume the components specified exist within the Registry, when that can't actually be assumed. Rather than doing an unwrap_unchecked on the component_index at the beginning of both methods, a regular unwrap should be done to trigger a panic if the component is not part of the Registry.

In the future, hopefully we can move this check to compile-time. Ideally, we'd be able to check if a component is a part of a Registry using a const fn, but that is currently only possible in nightly Rust. Perhaps it may be worthwhile to introduce a nightly feature gate to allow const checks.

@Anders429 Anders429 added the C - Bug Category: Something is not functioning as expected. label Jan 31, 2022
This was referenced Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - Bug Category: Something is not functioning as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant