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
Simplify equality assertions #10988
Simplify equality assertions #10988
Conversation
If I am not misunderstanding the failing test, it is testing if Rust's convertions work as intended, not if the table works as intended. I do not see a reason for that test to be in the engine in that case. |
crates/bevy_ecs/src/storage/table.rs
Outdated
@@ -56,7 +56,7 @@ impl TableId { | |||
/// Will panic if the provided value does not fit within a [`u32`]. | |||
#[inline] | |||
pub const fn from_usize(index: usize) -> Self { | |||
assert!(index as u32 as usize == index); | |||
assert_eq!(index as u32 as usize, index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we cannot use assert_eq!
in constant functions
crates/bevy_ecs/src/storage/table.rs
Outdated
@@ -116,7 +116,7 @@ impl TableRow { | |||
/// Will panic if the provided value does not fit within a [`u32`]. | |||
#[inline] | |||
pub const fn from_usize(index: usize) -> Self { | |||
assert!(index as u32 as usize == index); | |||
assert_eq!(index as u32 as usize, index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
|
Yes, and that is why I am saying the tests are wrong. They are testing if Rust works as intended. |
We check if |
01acc93
to
e0647c8
Compare
I think I understand it more now. Thank you for explaining. |
Objective
Solution