Skip to content

[Merged by Bors] - REMOVE unsound lifetime annotations on EntityMut - #4096

Closed
BoxyUwU wants to merge 5 commits into
bevyengine:mainfrom
BoxyUwU:port_ptrification_soundnes_fix
Closed

[Merged by Bors] - REMOVE unsound lifetime annotations on EntityMut#4096
BoxyUwU wants to merge 5 commits into
bevyengine:mainfrom
BoxyUwU:port_ptrification_soundnes_fix

Conversation

@BoxyUwU

@BoxyUwU BoxyUwU commented Mar 4, 2022

Copy link
Copy Markdown
Member

Fixes #3408
#3001 also solves this but I dont see it getting merged any time soon so...

Objective

make bevy ecs a lil bit less unsound

Solution

make EntityMut::get_component_mut return borrows from self instead of 'w

@github-actions github-actions Bot added the S-Needs-Triage This issue needs to be labelled label Mar 4, 2022
@BoxyUwU BoxyUwU added the A-ECS Entities, components, systems, and events label Mar 4, 2022
@alice-i-cecile alice-i-cecile added P-High This is particularly urgent, and deserves immediate attention C-Bug An unexpected or incorrect behavior and removed S-Needs-Triage This issue needs to be labelled labels Mar 4, 2022
@BoxyUwU
BoxyUwU force-pushed the port_ptrification_soundnes_fix branch from a1cd173 to 7e4eacd Compare March 4, 2022 04:08
@BoxyUwU BoxyUwU changed the title yeet 'w lifetime >:( yeet unsound lifetime annotations on Entity(Ref/Mut) >:( Mar 17, 2022
Comment thread crates/bevy_ecs/src/world/entity_ref.rs Outdated
Comment thread crates/bevy_ecs/src/world/entity_ref.rs Outdated
Comment thread crates/bevy_ecs/src/world/entity_ref.rs Outdated
Comment thread crates/bevy_ecs/src/world/entity_ref.rs Outdated

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The UB is clear, and upon examining this more closely, the 'w lifetime is clearly incorrect. I've left some comments to improve the docs and safety comments.

@BoxyUwU
BoxyUwU force-pushed the port_ptrification_soundnes_fix branch from 407a2de to 45da4b4 Compare March 17, 2022 22:07
Comment thread crates/bevy_ecs/src/world/entity_ref.rs
Comment thread crates/bevy_ecs/src/world/entity_ref.rs
Comment thread crates/bevy_ecs/src/world/entity_ref.rs
Comment thread crates/bevy_ecs/src/world/entity_ref.rs Outdated
@alice-i-cecile

Copy link
Copy Markdown
Member

@BoxyUwU can you resolve conversations now? :)

@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 Mar 18, 2022
@BoxyUwU BoxyUwU changed the title yeet unsound lifetime annotations on Entity(Ref/Mut) >:( REMOVE unsound lifetime annotations on Entity(Ref/Mut) Mar 22, 2022
@alice-i-cecile alice-i-cecile added this to the Bevy 0.7 milestone Mar 23, 2022
@BoxyUwU BoxyUwU changed the title REMOVE unsound lifetime annotations on Entity(Ref/Mut) REMOVE unsound lifetime annotations on EntityMut Mar 28, 2022
@BoxyUwU
BoxyUwU force-pushed the port_ptrification_soundnes_fix branch from e49da1f to 7203f9e Compare March 31, 2022 19:32
@BoxyUwU
BoxyUwU force-pushed the port_ptrification_soundnes_fix branch from 7203f9e to 05f0168 Compare April 3, 2022 09:31
@cart

cart commented Apr 4, 2022

Copy link
Copy Markdown
Member

bors r+

bors Bot pushed a commit that referenced this pull request Apr 4, 2022
Fixes #3408
#3001 also solves this but I dont see it getting merged any time soon so...
# Objective
make bevy ecs a lil bit less unsound

## Solution
make `EntityMut::get_component_mut` return borrows from self instead of `'w`
@bors bors Bot changed the title REMOVE unsound lifetime annotations on EntityMut [Merged by Bors] - REMOVE unsound lifetime annotations on EntityMut Apr 4, 2022
@bors bors Bot closed this Apr 4, 2022
aevyrie pushed a commit to aevyrie/bevy that referenced this pull request Jun 7, 2022
Fixes bevyengine#3408
bevyengine#3001 also solves this but I dont see it getting merged any time soon so...
# Objective
make bevy ecs a lil bit less unsound

## Solution
make `EntityMut::get_component_mut` return borrows from self instead of `'w`
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
Fixes bevyengine#3408
bevyengine#3001 also solves this but I dont see it getting merged any time soon so...
# Objective
make bevy ecs a lil bit less unsound

## Solution
make `EntityMut::get_component_mut` return borrows from self instead of `'w`
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 C-Bug An unexpected or incorrect behavior P-High This is particularly urgent, and deserves immediate attention S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

World entity access is not sound

5 participants