Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Ensure Query does not use the wrong World #7150

Closed
wants to merge 1 commit into from

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Jan 10, 2023

Query relies on the World it stores being the same as the world used for creating the QueryState it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, Query::new did not have a safety invariant or even an assertion that the WorldId's are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).

@BoxyUwU BoxyUwU added A-ECS Entities, components, systems, and events P-Unsound A bug that results in undefined compiler behavior labels Jan 10, 2023
let mut world1 = World::new();
let world2 = World::new();
let qstate = world1.query::<()>();
// SAFETY: doesnt access anything
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ the safety comment in a test on a line that should panic

@BoxyUwU BoxyUwU added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 10, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

bors bot pushed a commit that referenced this pull request Jan 10, 2023
`Query` relies on the `World` it stores being the same as the world used for creating the `QueryState` it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, `Query::new` did not have a safety invariant or even an assertion that the `WorldId`'s are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).
@bors
Copy link
Contributor

bors bot commented Jan 10, 2023

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Jan 10, 2023
`Query` relies on the `World` it stores being the same as the world used for creating the `QueryState` it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, `Query::new` did not have a safety invariant or even an assertion that the `WorldId`'s are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).
@bors
Copy link
Contributor

bors bot commented Jan 10, 2023

Build failed (retrying...):

@BoxyUwU BoxyUwU closed this Jan 10, 2023
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Jan 10, 2023

bors is bad so i guess I will just close this and wait until my other PR lands???

bors bot pushed a commit that referenced this pull request Jan 10, 2023
`Query` relies on the `World` it stores being the same as the world used for creating the `QueryState` it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, `Query::new` did not have a safety invariant or even an assertion that the `WorldId`'s are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Jan 10, 2023

nvm apparently bors will just retry a bunch and then try to merge with something else?

@BoxyUwU BoxyUwU reopened this Jan 10, 2023
@bors bors bot changed the title Ensure Query does not use the wrong World [Merged by Bors] - Ensure Query does not use the wrong World Jan 10, 2023
@bors bors bot closed this Jan 10, 2023
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
`Query` relies on the `World` it stores being the same as the world used for creating the `QueryState` it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, `Query::new` did not have a safety invariant or even an assertion that the `WorldId`'s are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
`Query` relies on the `World` it stores being the same as the world used for creating the `QueryState` it stores. If they are not the same then everything is very unsound. This was not actually being checked anywhere, `Query::new` did not have a safety invariant or even an assertion that the `WorldId`'s are the same.

This shouldn't have any user facing impact unless we have really messed up in bevy and have unsoundness elsewhere (in which case we would now get a panic instead of being unsound).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events P-Unsound A bug that results in undefined compiler behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants