bevy/crates
BD103 cd497152bb
Fix error in bevy_ui when building without bevy_text (#14430)
# 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.
2024-07-22 19:19:10 +00:00
..
bevy_a11y Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_animation Fix repeated animation transition bug (#14411) 2024-07-22 19:17:46 +00:00
bevy_app Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_asset Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_audio Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_color Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_core Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_core_pipeline Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_derive Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dev_tools Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_diagnostic Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dylib Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dynamic_plugin Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_ecs Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_encase_derive Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_gilrs Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_gizmos Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_gltf Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_hierarchy Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_input Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_internal Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_log Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_macro_utils Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_math Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_mikktspace Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_pbr Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_picking Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_ptr Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_reflect Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_render Added AstcBlock and AstcChannel to the forwarded wgpu types. (#14410) 2024-07-22 19:14:14 +00:00
bevy_scene Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_sprite Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_state Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_tasks Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_text feat: expose the default font bytes (#14406) 2024-07-22 19:09:39 +00:00
bevy_time Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_transform Only propagate transforms entities with GlobalTransforms. (#14384) 2024-07-22 19:07:21 +00:00
bevy_ui Fix error in bevy_ui when building without bevy_text (#14430) 2024-07-22 19:19:10 +00:00
bevy_utils Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_window Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_winit Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00