Skip to content

Commit

Permalink
Actually check alignment in BlobVec test aligned_zst (#10885)
Browse files Browse the repository at this point in the history
Do not rely on Miri.

---------

Co-authored-by: James Liu <[email protected]>
  • Loading branch information
stepancheg and james7132 authored Dec 13, 2023
1 parent 41db723 commit 12a11e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bevy_ecs/src/storage/blob_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ mod tests {
use crate::{component::Component, ptr::OwningPtr, world::World};

use super::BlobVec;
use std::{alloc::Layout, cell::RefCell, rc::Rc};
use std::{alloc::Layout, cell::RefCell, mem, rc::Rc};

// SAFETY: The pointer points to a valid value of type `T` and it is safe to drop this value.
unsafe fn drop_ptr<T>(x: OwningPtr<'_>) {
Expand Down Expand Up @@ -626,7 +626,9 @@ mod tests {
let mut count = 0;

let mut q = world.query::<&Zst>();
for &Zst in q.iter(&world) {
for zst in q.iter(&world) {
// Ensure that the references returned are properly aligned.
assert_eq!(zst as *const Zst as usize % mem::align_of::<Zst>(), 0);
count += 1;
}

Expand Down

0 comments on commit 12a11e2

Please sign in to comment.