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

ptr: allow Ptr and PtrMut construction for references to values of ?Sized types #14479

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

soqb
Copy link
Contributor

@soqb soqb commented Jul 25, 2024

Objective

  • Currently bevy_ptr::{Ptr, PtrMut} have From implementations from references.
  • These implementations impose an implicit Sized bound so bevy_ptr types cannot be created from references to slices and trait objects.
  • I ran into this trying to use Ptr<'static> as an untyped &'static dyn Any, and had to work around it.

Solution

  • Relax the Sized bound on the relevant From implementations.

@soqb soqb added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Pointers Relating to Bevy pointer abstractions D-Unsafe Touches with unsafe code in some way S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jul 25, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Jul 25, 2024
@hymm hymm added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 25, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 25, 2024
Merged via the queue into bevyengine:main with commit 6dbc8b8 Jul 25, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Pointers Relating to Bevy pointer abstractions C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples D-Unsafe Touches with unsafe code in some way 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.

3 participants