rustgd / rhusics

A cgmath physics library that can be used with Specs
https://docs.rs/rhusics/
Apache License 2.0
106 stars 10 forks source link

New release? #95

Open RalfJung opened 4 years ago

RalfJung commented 4 years ago

This crate came up as a regression in https://github.com/rust-lang/rust/pull/71274, where we are trying to improve rustc's abilitiy to detect misuse of uninitialized memory. I was able to reproduce that problem locally, but it is fixed on master. Is there any chance of a new release of this crate containing the fix?

Here's the stacktrace for the bug (generated by running https://github.com/rust-lang/miri/ on the old broken version):

error: Undefined Behavior: type validation failed: encountered uninitialized box at .value[0].value.0
   --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/maybe_uninit.rs:505:38
    |
505 |             ManuallyDrop::into_inner(self.value)
    |                                      ^^^^^^^^^^ type validation failed: encountered uninitialized box at .value[0].value.0
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

    = note: inside `std::mem::MaybeUninit::<[std::cell::UnsafeCell<(std::boxed::Box<dyn specs::world::lazy::LazyUpdateInternal>, std::sync::atomic::AtomicBool)>; 32]>::assume_init` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/maybe_uninit.rs:505:38
    = note: inside `std::mem::uninitialized::<[std::cell::UnsafeCell<(std::boxed::Box<dyn specs::world::lazy::LazyUpdateInternal>, std::sync::atomic::AtomicBool)>; 32]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/mod.rs:667:9
    = note: inside `crossbeam::seg_queue::Segment::<std::boxed::Box<dyn specs::world::lazy::LazyUpdateInternal>>::new` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.4.1/src/seg_queue.rs:41:46
    = note: inside `crossbeam::seg_queue::SegQueue::<std::boxed::Box<dyn specs::world::lazy::LazyUpdateInternal>>::new` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.4.1/src/seg_queue.rs:62:35
    = note: inside `<specs::world::lazy::Queue<std::boxed::Box<dyn specs::world::lazy::LazyUpdateInternal>> as std::default::Default>::default` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/specs-0.14.3/src/world/lazy.rs:9:15
    = note: inside `<specs::LazyUpdate as std::default::Default>::default` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/specs-0.14.3/src/world/lazy.rs:84:32
    = note: inside `<specs::World as std::default::Default>::default` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/specs-0.14.3/src/world/mod.rs:637:20
    = note: inside `specs::World::new` at /home/r/.cargo/registry/src/github.com-1ecc6299db9ec823/specs-0.14.3/src/world/mod.rs:249:9
note: inside `physics::resources::tests::test` at rhusics-ecs/src/physics/resources.rs:297:25
   --> rhusics-ecs/src/physics/resources.rs:297:25
    |
297 |         let mut world = World::new();
    |                         ^^^^^^^^^^^^
note: inside closure at rhusics-ecs/src/physics/resources.rs:296:5
   --> rhusics-ecs/src/physics/resources.rs:296:5
    |
296 | /     fn test() {
297 | |         let mut world = World::new();
298 | |         PhysicalEntityPartsTest::setup(&mut world.res);
299 | |         PhysicalEntityPartsTest::new(&world);
300 | |     }
    | |_____^

So, updating the dependencies fixed the problem here it seems.