Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Objective - `bevy_ui` does not build without the `bevy_text` feature due to improper feature gating. - Specifically, `MeasureArgs<'a>` had an unused lifetime `'a` without `bevy_text` enabled. This is because it stores a reference to a `cosmic_text::FontSystem`. - This was caught by `flag-frenzy` in [this run](https://github.com/TheBevyFlock/flag-frenzy/actions/runs/10024258523/job/27706132250). ## Solution - Add a `PhantomData` to `MeasureArgs<'a>` in order to maintain its lifetime argument. - I also named it `font_system`, after the feature-gated argument that actually needs a lifetime, for usability. Please comment if you have a better solution! - Move some unused imports to be behind the `bevy_text` feature gate. ## Testing ```bash # Fails on main. cargo check -p bevy_ui --no-default-features # Succeeds on main. cargo check -p bevy_ui --no-default-features -F bevy_text ``` --- ## Migration Guide **This is not a breaking change for users migrating from 0.14, since `MeasureArgs` did not exist then.** When the `bevy_text` feature is disabled for `bevy_ui`, the type of the `MeasureArgs::font_system` field is now a `PhantomData` instead of being removed entirely. This is in order to keep the lifetime parameter, even though it is unused without text being enabled.
- Loading branch information