Skip to content

Add AsArrayRef/AsArrayMut traits - #135

Merged
tarcieri merged 1 commit into
masterfrom
add-array-ref-and-mut-traits
Sep 1, 2025
Merged

Add AsArrayRef/AsArrayMut traits#135
tarcieri merged 1 commit into
masterfrom
add-array-ref-and-mut-traits

Conversation

@tarcieri

Copy link
Copy Markdown
Member

Impl'd for Array<T, U> and [T; N].

This is an alternative to #134, given the trouble we had in #131 with adding impls of core traits to [T; N] and the ensuing inference conflicts it can cause.

The safest thing we can do is define our own traits, and these traits bound on AssocArraySize so they're able to handle everything related to the array size themselves, making them generic around only T.

With this we can revert #134, which still has the potential to cause problems similar to #131. Using our own trait guarantees we won't break inference in existing code.

@tarcieri
tarcieriforce-pushed the add-array-ref-and-mut-traits branch from c552d56 to 1dbbb2cCompareSeptember 1, 2025 16:39
Impl'd for `Array<T, U>` and `[T; N]`.
This is an alternative to #134, given the trouble we had in #131 with
adding impls of core traits to `[T; N]` and the ensuing inference
conflicts it can cause.
The safest thing we can do is define our own traits, and these traits
bound on `AssocArraySize` so they're able to handle everything related
to the array size themselves, making them generic around only `T`.
With this we can revert #134, which still has the potential to cause
problems similar to #131. Using our own trait guarantees we won't break
inference in existing code.
@tarcieri
tarcieriforce-pushed the add-array-ref-and-mut-traits branch from 1dbbb2c to a8bd11fCompareSeptember 1, 2025 16:40
@tarcieri

Copy link
Copy Markdown
MemberAuthor

@newpavlov if this looks good to you, I'd like to merge this, revert #134 to prevent any future inference problems similar to #131, then cut a new major version and start updating... well, everything (including a new release of dbl)

@tarcieri
tarcieri merged commit 0450c2b into masterSep 1, 2025
14 checks passed
@tarcieri
tarcieri deleted the add-array-ref-and-mut-traits branch September 1, 2025 18:07
tarcieri added a commit that referenced this pull request Sep 1, 2025
This reverts commit 1e21e27 (#134)
To avoid any future inference problems like #131.
Instead #135 adds traits impl'd on `[T; N]` which provide equivalent
functionality.
tarcieri added a commit that referenced this pull request Sep 1, 2025
This reverts commit 1e21e27 (#134)
To avoid any future inference problems like #131.
Instead #135 adds traits impl'd on `[T; N]` which provide equivalent
functionality.
@tarcieritarcieri mentioned this pull request Sep 1, 2025
Merged
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@tarcieri@newpavlov