Skip to content

Support array repeat expressions (Rvalue::Repeat) - #315

Merged
coord-e merged 1 commit into
mainfrom
fix-array-repeat
Oct 2, 2026
Merged

coord-e merged 1 commit into
mainfrom
fix-array-repeat

Conversation

@coord-e

@coord-e coord-e commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Closes #305

[x; N] (Rvalue::Repeat) previously hit unimplemented!("rvalue=..") in rvalue_type. It is now typed as a sequence of N copies of x, expanded the same way the AggregateKind::Array arm expands array literals. The count must evaluate to a concrete constant (try_to_target_usize); a non-constant count (e.g. a const generic) panics.

Tests: tests/ui/{pass,fail}/array_repeat.rs check the length and an element of [7i32; 4].

🤖 Generated with Claude Code

https://claude.ai/code/session_01FWDbM7FpNXVukbHmQcGNoH


Generated by Claude Code

Type `[x; N]` as a sequence of `N` copies of `x`, expanding it the same
way the array literal arm does. The count must evaluate to a concrete
constant.

Closes #305

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FWDbM7FpNXVukbHmQcGNoH
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T22:50:35.006956Z a3e133a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: a3e133a2f6

ℹ️ 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 on lines +744 to +745
for _ in 0..count {
seq = seq.seq_concat(elem_term.clone().seq_unit());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid expanding repeat expressions one element at a time

For valid repeat arrays with counts in the thousands, this loop creates a deeply nested seq.++ term and crashes Thrust before the solver runs. Using the built thrust-rustc, [7i32; 5000] reliably overflowed rustc's stack, while a count of 1000 already produced an 18 MB SMT file. Compact repeat arrays are common for buffers, so the sequence needs a non-linearly nested representation or explicit handling for large counts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

i'm merging this for now and I'll follow-up with another (possible more effective?) option

@coord-e
coord-e merged commit 429c643 into main Oct 2, 2026
8 of 9 checks passed
@coord-e
coord-e deleted the fix-array-repeat branch October 2, 2026 07:21
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.

Array repeat expressions ([0; N], Rvalue::Repeat) abort with unimplemented!("rvalue=..")

2 participants