Skip to content

Some examples broken after introducing runtime borrow checking #245

@richardhozak

Description

@richardhozak

Hello, I've tried to run the example queries/query_change_tracking_1.rs with latest master (c3da92c) and I've noticed that it fails on assertions.

The lines that trigger the assertions are these:

        let pos = it.field_mut::<Position>(0).unwrap();
        let parent_pos = it.field_mut::<Position>(1); // Optional
        let mut world_pos = it.field_mut::<WorldPosition>(2).unwrap();

We want to get position of entity and also the position of parent, but since they are the same component, the assertion gets triggered.

This code was previously this:

        let pos = it.field::<&Position>(0).unwrap();
        let parent_pos = it.field::<&Position>(1); // Optional
        let mut world_pos = it.field::<&mut WorldPosition>(2).unwrap();

Is there a way to do this now that runtime borrow checking is implemented? I've reverted to previous revision to mitigate this issue but I'd like to use latest master as it is easier to browse the examples and learn from them.

Thanks!

For those who are also experiencing this issue the latest revision before borrow checking is 6f89f9d, that one works with the examples I've tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions