346
General Discussion / Re: Things that made you sad today thread.
« on: January 12, 2018, 12:59:32 pm »
The rust borrowchecker is having a field day on my code. 
(I already figured out a fix, so no help needed)

Quote
error[E0277]: the trait bound `core::tile::MapLayer<'_> + 'static: std::marker::Sync` is not satisfied
--> src/main.rs:14:8
|
14 | world.add_resource(Vec::<std::sync::Arc<std::sync::RwLock<&mut tile::GameMap>>>::new())
| ^^^^^^^^^^^^ `core::tile::MapLayer<'_> + 'static` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `core::tile::MapLayer<'_> + 'static`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<core::tile::MapLayer<'_> + 'static>`
= note: required because it appears within the type `std::boxed::Box<core::tile::MapLayer<'_> + 'static>`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<std::boxed::Box<core::tile::MapLayer<'_> + 'static>>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<std::boxed::Box<core::tile::MapLayer<'_> + 'static>>`
= note: required because it appears within the type `std::vec::Vec<std::boxed::Box<core::tile::MapLayer<'_> + 'static>>`
= note: required because it appears within the type `core::tile::GameMap<'_>`
= note: required because it appears within the type `&mut core::tile::GameMap<'_>`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::RwLock<&mut core::tile::GameMap<'_>>`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<std::sync::RwLock<&mut core::tile::GameMap<'_>>>`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::sync::Arc<std::sync::RwLock<&mut core::tile::GameMap<'_>>>>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<std::sync::Arc<std::sync::RwLock<&mut core::tile::GameMap<'_>>>>`
= note: required because it appears within the type `std::vec::Vec<std::sync::Arc<std::sync::RwLock<&mut core::tile::GameMap<'_>>>>`
= note: required because of the requirements on the impl of `shred::res::Resource` for `std::vec::Vec<std::sync::Arc<std::sync::RwLock<&mut core::tile::GameMap<'_>>>>`
(I already figured out a fix, so no help needed)
