Remove dedicated methods for upcasting from bevy_reflect
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
As seen in https://dev-docs.bevy.org/bevy/reflect/index.html#converting-between-partialreflect-and-reflect:
> Since T: Reflect implies T: PartialReflect, conversion from a dyn Reflect to a dyn PartialReflect trait object (upcasting) is infallible and can be performed with one of the following methods. Note that these are temporary while [the language feature for dyn upcasting coercion](https://github.com/rust-lang/rust/issues/65991) is experimental:
>
> [PartialReflect::as_partial_reflect](https://dev-docs.bevy.org/bevy/prelude/trait.PartialReflect.html#tymethod.as_partial_reflect) for &dyn PartialReflect
> [PartialReflect::as_partial_reflect_mut](https://dev-docs.bevy.org/bevy/prelude/trait.PartialReflect.html#tymethod.as_partial_reflect_mut) for &mut dyn PartialReflect
> [PartialReflect::into_partial_reflect](https://dev-docs.bevy.org/bevy/prelude/trait.PartialReflect.html#tymethod.into_partial_reflect) for Box
However, https://github.com/rust-lang/rust/issues/65991 is closed! This was [added in Rust 1.86](https://doc.rust-lang.org/beta/releases.html#language-3).
We should remove these methods, and update the docs to explain the simpler language-supported mechanism for this.
Contributor guide
Research direction
Start at the PartialReflect API and the documentation section on converting between PartialReflect and Reflect, then search the repository for as_partial_reflect, as_partial_reflect_mut, and into_partial_reflect. Remove the dedicated methods and update the documentation to describe Rust's dyn upcasting coercion; done means the obsolete API and temporary explanation are gone and the project still builds and tests successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100