Skip to content

Use <[T]>::array_windows for exact size windows#24146

Merged
alice-i-cecile merged 4 commits into
bevyengine:mainfrom
DavidCrossman:use_array_windows
May 6, 2026
Merged

Use <[T]>::array_windows for exact size windows#24146
alice-i-cecile merged 4 commits into
bevyengine:mainfrom
DavidCrossman:use_array_windows

Conversation

@DavidCrossman
Copy link
Copy Markdown
Contributor

@DavidCrossman DavidCrossman commented May 5, 2026

Objective

  • Reduce panicking code and bounds checks.

Solution

  • Replace <[T]>::windows with <[T]>::array_windows when the window size is constant.
  • Update MSRV in affected crates (and fix the new warnings).

Testing

  • Ran cargo test -p bevy_mesh -p bevy_gizmos -p bevy_math -p bevy_input_focus

MSRV

The main bevy crate has a MSRV of 1.95; I've increased the MSRV to 1.94 (when array_windows was stabilised) for bevy_math and bevy_input_focus in this PR. If it's too early to increase the MSRV, I can drop the changes to these crates in this PR or convert this PR to draft.

@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change A-Cross-Cutting Impacts the entire engine X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 6, 2026
@alice-i-cecile alice-i-cecile requested a review from kfc35 May 6, 2026 00:05
Copy link
Copy Markdown
Member

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

Choose a reason for hiding this comment

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

I've carefully reviewed this and could find any bugs. I like the cleanup and increased robustness!

@alice-i-cecile alice-i-cecile 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 May 6, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 6, 2026
Merged via the queue into bevyengine:main with commit e761a17 May 6, 2026
55 checks passed
allocatedribble added a commit to allocatedribble/bevy that referenced this pull request May 6, 2026
Cherry-pick clean upstream changes from bevyengine/bevy through 15b23b4 while leaving the destructive rewritten full upstream range unmerged.

Included upstream PRs:

- bevyengine#22447: update intel_tex_2 for the mipmap generator example

- bevyengine#23069: update getrandom dev dependency to 0.4

- bevyengine#24142: add Disabled/Enabled state-scoped components

- bevyengine#22488: move window/input-focus/custom-cursor feature ownership out of default_app

- bevyengine#24144: filter tuple fields when generating BSN props

- bevyengine#24138: fix UI overflow clip margin resolution

- bevyengine#24139: add Rect::translate

- bevyengine#24146: use array_windows for fixed-size slice windows

- bevyengine#21830: document physical-pixel viewport requirements

Skipped CI-only cache/action bumps because they do not improve the engine or Fun runtime surface.

Validation: git diff --cached --check; cargo fmt --check -p bevy_camera -p bevy_gizmos -p bevy_input_focus -p bevy_math -p bevy_mesh -p bevy_scene -p bevy_scene_macros -p bevy_state -p bevy_ui; cargo test -p bevy_math rect_translate --lib; cargo test -p bevy_ui overflow_clip_margin --lib; cargo test -p bevy_scene scene_component_name_reference --lib; cargo check -p bevy_camera -p bevy_gizmos -p bevy_input_focus -p bevy_math -p bevy_mesh -p bevy_scene -p bevy_state -p bevy_ui; cargo check -p bevy --no-default-features --features default_app; cargo check -p bevy --no-default-features --features ui_api; downstream cargo check -p fun_render; downstream cargo check -p game_client
@DavidCrossman DavidCrossman deleted the use_array_windows branch May 6, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Cross-Cutting Impacts the entire engine C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants