Skip to content

InnerArray: remove generic + unsafe methods in favor of AnyArray#1506

Merged
Bromeon merged 1 commit intomasterfrom
qol/collection-typing
Feb 17, 2026
Merged

InnerArray: remove generic + unsafe methods in favor of AnyArray#1506
Bromeon merged 1 commit intomasterfrom
qol/collection-typing

Conversation

@Bromeon
Copy link
Member

@Bromeon Bromeon commented Feb 17, 2026

#1357 introduced special codegen: selected builtin methods returning arrays are now unsafe, and some of them generic. The reason behind this was that methods like Array::duplicate returned VarArray per JSON declaration, but in fact the returned array is typed. This is unsound if used as-is, which is why there was an unsafe conversion for the Array client code.

The existence of AnyArray (and AnyDictionary) as a covariant base makes this no longer necessary: we can simply return AnyArray and then use a safe downcast to the correct type. This would theoretically panic (not cause UB), but as long as Godot upholds its contract, it's infallible.

@Bromeon Bromeon added this to the 0.5 milestone Feb 17, 2026
@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals c: core Core components c: ffi Low-level components and interaction with GDExtension API labels Feb 17, 2026
@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1506

@Bromeon Bromeon added this pull request to the merge queue Feb 17, 2026
Merged via the queue into master with commit 2fba258 Feb 17, 2026
23 checks passed
@Bromeon Bromeon deleted the qol/collection-typing branch February 17, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: core Core components c: ffi Low-level components and interaction with GDExtension API quality-of-life No new functionality, but improves ergonomics/internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants