Skip to content

Enable to take non-model type as index part of Array ops#135

Merged
coord-e merged 1 commit into
mainfrom
coord-e/array-index-weaken
Jun 16, 2026
Merged

Enable to take non-model type as index part of Array ops#135
coord-e merged 1 commit into
mainfrom
coord-e/array-index-weaken

Conversation

@coord-e

@coord-e coord-e commented Jun 16, 2026

Copy link
Copy Markdown
Owner

small fix to index into Array<Int, T> by integer constant literal

@coord-e coord-e merged commit e9cdea4 into main Jun 16, 2026
6 checks passed
@coord-e coord-e deleted the coord-e/array-index-weaken branch June 16, 2026 17:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 549bc830ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread std.rs
}

impl<I, T> std::ops::Index<I> for Array<I, T> {
impl<I, T, U> std::ops::Index<U> for Array<I, T> where U: super::Model<Ty = I> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve exact array indexing for generic model indices

When a spec/helper is generic over the array's model index type, e.g. fn f<I: thrust_models::Model, T>(a: Array<I, T>, i: I) { let _ = &a[i]; }, this impl no longer applies unless <I as Model>::Ty == I. The previous Index<I> impl accepted that exact model index, but the new bound only supports source types that lower to I, so polymorphic array specs and arrays indexed by non-self model types are rejected at type checking; the same restriction was added to store below.

Useful? React with 👍 / 👎.

Sign up for free to 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.

1 participant