-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require components viewed in Schedule to implement Sync.
- Loading branch information
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use brood::{query::{Views, filter, Result}, registry, World, Registry, system::{System, schedule}}; | ||
// This import is technically unused, since the macro fails to compile before it would be consumed. | ||
// I'm leaving it here, though, for completeness; user code would use this module, and these tests | ||
// should do their best to simulate user code. | ||
#[allow(unused_imports)] | ||
use brood::system::schedule::task; | ||
use std::rc::Rc; | ||
|
||
struct A; | ||
|
||
struct Foo; | ||
|
||
impl System for Foo { | ||
type Views<'a> = Views!(&'a Rc<A>); | ||
type Filter = filter::None; | ||
type ResourceViews<'a> = Views!(); | ||
type EntryViews<'a> = Views!(); | ||
|
||
fn run<'a, R, S, I, E>( | ||
&mut self, | ||
_query_results: Result<R, S, I, Self::ResourceViews<'a>, Self::EntryViews<'a>, E>, | ||
) where | ||
R: registry::Registry, | ||
I: Iterator<Item = Self::Views<'a>>, | ||
{ | ||
unimplemented!() | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut world = World::<Registry!(Rc<A>)>::new(); | ||
|
||
let schedule = schedule!(task::System(Foo)); | ||
|
||
world.run_schedule(&mut schedule); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0277]: `Rc<A>` cannot be shared between threads safely | ||
--> tests/trybuild/schedule/non_send_views.rs:35:24 | ||
| | ||
35 | world.run_schedule(&mut schedule); | ||
| ------------ ^^^^^^^^^^^^^ `Rc<A>` cannot be shared between threads safely | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `Sync` is not implemented for `Rc<A>` | ||
= note: required for `&Rc<A>` to implement `Send` | ||
= note: required because it appears within the type `(&Rc<A>, Null)` | ||
= note: required for `brood::system::schedule::task::System<Foo>` to implement `brood::system::schedule::task::sealed::Task<'_, (Rc<A>, brood::registry::Null), brood::resource::Null, (registry::contains::Null, (registry::contains::Contained, registry::contains::Null), (registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), (resource::contains::Null, resource::contains::Null, resource::contains::Null, resource::contains::Null), (((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), view::disjoint::Null, ((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), view::disjoint::Null), ((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null)>` | ||
= note: required for `(brood::system::schedule::task::System<Foo>, brood::system::schedule::task::Null)` to implement `schedule::stager::Cutoff<'_, (Rc<A>, brood::registry::Null), brood::resource::Null, schedule::claim::decision::Append, ((&Rc<A>, brood::query::view::Null), schedule::claim::Null), schedule::stager::Null, schedule::stager::Null, schedule::stager::Null, schedule::stager::Null, (brood::query::view::Null, schedule::claim::Null), schedule::stager::Null, schedule::stager::Null, schedule::stager::Null, ((registry::contains::Null, (registry::contains::Contained, registry::contains::Null), (registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), schedule::stage::Null), ((resource::contains::Null, resource::contains::Null, resource::contains::Null, resource::contains::Null), schedule::stage::Null), ((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), view::disjoint::Null, ((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), view::disjoint::Null), schedule::stage::Null), (((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), schedule::stage::Null)>` | ||
= note: required for `(brood::system::schedule::task::System<Foo>, brood::system::schedule::task::Null)` to implement `schedule::scheduler::Scheduler<'_, (Rc<A>, brood::registry::Null), brood::resource::Null, ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), (((((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), ((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), (view::merge::Neither, (view::merge::Left, view::merge::Null))), schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), (((registry::contains::Null, (registry::contains::Contained, registry::contains::Null), (registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), schedule::stage::Null), schedule::stages::Null), (((resource::contains::Null, resource::contains::Null, resource::contains::Null, resource::contains::Null), schedule::stage::Null), schedule::stages::Null), (((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), view::disjoint::Null, ((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), view::disjoint::Null), schedule::stage::Null), schedule::stages::Null), ((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), schedule::stage::Null), schedule::stages::Null)>` | ||
= note: required for `(brood::system::schedule::task::System<Foo>, brood::system::schedule::task::Null)` to implement `schedule::sealed::Sealed<'_, (Rc<A>, brood::registry::Null), brood::resource::Null, (((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), (((((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), ((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), (view::merge::Neither, (view::merge::Left, view::merge::Null))), schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), (((registry::contains::Null, (registry::contains::Contained, registry::contains::Null), (registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), schedule::stage::Null), schedule::stages::Null), (((resource::contains::Null, resource::contains::Null, resource::contains::Null, resource::contains::Null), schedule::stage::Null), schedule::stages::Null), (((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), view::disjoint::Null, ((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), view::disjoint::Null), schedule::stage::Null), schedule::stages::Null), ((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), schedule::stage::Null), schedule::stages::Null))>` | ||
= note: required for `(brood::system::schedule::task::System<Foo>, brood::system::schedule::task::Null)` to implement `Schedule<'_, (Rc<A>, brood::registry::Null), brood::resource::Null, (((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::scheduler::Null), (((((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), ((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), (view::merge::Neither, (view::merge::Left, view::merge::Null))), schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), ((schedule::claim::Null, schedule::stager::Null), schedule::stages::Null), (((registry::contains::Null, (registry::contains::Contained, registry::contains::Null), (registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), schedule::stage::Null), schedule::stages::Null), (((resource::contains::Null, resource::contains::Null, resource::contains::Null, resource::contains::Null), schedule::stage::Null), schedule::stages::Null), (((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), view::disjoint::Null, ((registry::contains::NotContained, (®istry::contains::Contained, registry::contains::Null)), (brood::query::result::get::Index, registry::contains::Null), (brood::query::result::get::Index, brood::query::result::reshape::Null)), view::disjoint::Null), schedule::stage::Null), schedule::stages::Null), ((((registry::contains::NotContained, (registry::contains::NotContained, registry::contains::Null)), registry::contains::Null, brood::query::result::reshape::Null), schedule::stage::Null), schedule::stages::Null))>` | ||
note: required by a bound in `World::<R, Resources>::run_schedule` | ||
--> src/world/mod.rs | ||
| | ||
| S: Schedule<'a, R, Resources, Indices>, | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `World::<R, Resources>::run_schedule` |