Skip to content

Commit

Permalink
Fixed SystemBuilder requiring that all resource views impl Send
Browse files Browse the repository at this point in the history
  • Loading branch information
TomGillen committed Sep 28, 2020
1 parent 8fe8fd9 commit 0733aa3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "legion"
version = "0.3.0"
version = "0.3.1"
description = "High performance entity component system (ECS) library"
authors = ["Thomas Gillen <[email protected]>"]
repository = "https://github.com/amethyst/legion"
Expand Down
4 changes: 2 additions & 2 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ impl Sig {
}
Type::Reference(ty) => {
let mutable = ty.mutability.is_some();
let resource = Self::find_remove_arg_attr(&mut arg.attrs);
match resource {
let attribute = Self::find_remove_arg_attr(&mut arg.attrs);
match attribute {
Some(ArgAttr::Resource) => {
if mutable {
parameters.push(Parameter::ResourceMut(write_resources.len()));
Expand Down
2 changes: 1 addition & 1 deletion src/internals/systems/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl Default for SystemBuilder<(), ()> {
impl<Q, R> SystemBuilder<Q, R>
where
Q: 'static + Send + ConsFlatten,
R: 'static + Send + ConsFlatten,
R: 'static + ConsFlatten,
{
/// Provides a name to the system being built.
pub fn with_name(self, name: SystemId) -> Self {
Expand Down
20 changes: 20 additions & 0 deletions tests/systems_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ mod tests {
Schedule::builder().add_system(basic_system()).build();
}

#[test]
fn with_not_sendsync_resource() {
struct NotSync(*const usize);

#[system]
fn basic(#[resource] _: &NotSync) {}

Schedule::builder().add_thread_local(basic_system()).build();
}

#[test]
fn with_mut_not_sendsync_resource() {
struct NotSync(*const usize);

#[system]
fn basic(#[resource] _: &mut NotSync) {}

Schedule::builder().add_thread_local(basic_system()).build();
}

#[test]
fn with_world() {
#[system]
Expand Down

0 comments on commit 0733aa3

Please sign in to comment.