Skip to content

Fix TODOs in into_impl.rs: implement GetMany and simplify collect - #4153

Merged
Kenny Kerr (kennykerr) merged 4 commits into
masterfrom
copilot/fix-old-todos-in-into-impl
Apr 7, 2026
Merged

Fix TODOs in into_impl.rs: implement GetMany and simplify collect#4153
Kenny Kerr (kennykerr) merged 4 commits into
masterfrom
copilot/fix-old-todos-in-into-impl

Conversation

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Two stale TODOs in crates/tests/libs/implement/tests/into_impl.rs — array support via GetMany and a commented-out collect() call.

  • GetMany: Was panic!() with a TODO. Now properly implemented: reads current position, copies actual = min(remaining, capacity) elements from Vec<T> into [T::Default] via .zip(), advances the position. Added T: Into<<T as Type<T>>::Default> to both struct declarations and impl where clauses (required so the implement macro can generate valid vtable boilerplate; holds for all RuntimeTypes: value/copy types have T::Default = T; interface types satisfy T: Into<Option<T>>).

  • collect(): source.collect() doesn't compile because IIterable<T> implements IntoIterator, not Iterator. Replaced the manual for-loop workaround with the correct idiom:

let values: Vec<i32> = source.into_iter().collect();

@kennykerr

Copy link
Copy Markdown
Collaborator

Copilot fmt failed

Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/b005648c-6311-4253-ba6a-b25c9bcf4ba5

Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fmt failed

Fixed in ab90ee7.

@kennykerr

Copy link
Copy Markdown
Collaborator

Copilot check build failure

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Copilot check build failure

Fixed in 97a5011. The T: Into<<T as Type<T>>::Default> bound was on the impl block but not on the struct declarations — the implement macro generates vtable boilerplate using the struct's where clause, so it couldn't satisfy the bound when building IIterator_Vtbl::new. Added the bound to both struct declarations (Iterator<T> and Iterable<T>).

@kennykerr
Kenny Kerr (kennykerr) marked this pull request as ready for review April 7, 2026 18:39
@kennykerr
Kenny Kerr (kennykerr) merged commit 0c719dc into master Apr 7, 2026
30 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the copilot/fix-old-todos-in-into-impl branch April 7, 2026 18:39
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.

2 participants