Skip to content

quest(m3): delete BinaryHeap from std's MIR - #637

Merged
kixelated merged 4 commits into
mainfrom
quest/m3/ts-unsafe/binary-heap-mir
Nov 7, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m3/ts-unsafe/binary-heap-mir

Conversation

@kixelated

@kixelated kixelated commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Deletes BinaryHeap from std's MIR and its link in the ts-unsafe epic. The runtime's port (rs.BinaryHeap, rs.PeekMut in ts/runtime/rs/collections.ts) stays.

Why

  • std structs and writing std functions. No std struct translates from MIR: an unmapped std ADT is refused as "unsupported type from another crate" (ts/src/lower/mod.rs). std's heap needs BinaryHeap<T, A>, PeekMut, Hole, RebuildOnDrop, Iter, IntoIter, and Drain to translate as the crate's own structs do. And library::from_mir refuses std functions that are unsafe or take &mut or a raw pointer, which covers nearly every heap method.
  • Elements JS keeps as objects are refused. Hole::move_to is ptr::copy_nonoverlapping(data.as_mut_ptr().add(index), data.as_mut_ptr().add(pos), 1): pointer arithmetic into an array of objects, which the epic's 2026-11-01 decision refuses. Every object heap in the orders case (Item, tuples, [u8; 2], String) would become a refusal.
  • Even for copied elements, MIR is slower. The sibling Vec::drain spike measured std's Drain from MIR at 3 to 12x the port's CPU time for u8/u32 elements (Node 24, CPU time on a loaded host), with most of it in Proxy reads of the Vec's room. No heap translation exists to measure, but Hole reads and writes through the same room.

The port follows std's sifts line for line, and the orders differential case tests it against native on every just ci.

Decisions

  • ✅ Delete this quest and Vec::drain from std's MIR, keeping the runtime's ports (maintainer, 2026-11-07).
  • Rejected: an epic with prerequisites (std structs and writing std functions from MIR; pointers into arrays of objects, which would reopen the 2026-11-01 decision).
  • Rejected: MIR only for elements JS copies, which leaves two implementations behind one type and the port still tracking std by hand.

Impact

None: quest files only. No public API or wire change.

Validation

  • quest check --fix: ok.
  • just check: passed (lint, quest).

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort

Review

Skipped: a quest-only deletion needs no review round.

(Written by Claude Opus 5.5 with high effort)

🤖 Generated with Claude Code

@pullfrog

pullfrog Bot commented Nov 7, 2026

Copy link
Copy Markdown

Pullfrog  | Review this ➔

kixelated and others added 2 commits November 7, 2026 06:39
std's BinaryHeap needs std structs and writing std functions translated
from MIR, which the translator refuses, and Hole's pointer arithmetic
into arrays of objects, which the epic's 2026-11-01 decision refuses.
The port follows std's sifts line for line and is tested against native
on every `just ci`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title BinaryHeap from std's MIR quest(m3): delete BinaryHeap from std's MIR Nov 7, 2026
@kixelated
kixelated marked this pull request as ready for review November 7, 2026 15:22
@kixelated
kixelated added this pull request to the merge queue Nov 7, 2026

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed commit fa6c31f against base 6231cec.

No actionable findings in this two-file documentation change. The BinaryHeap MIR quest and its Required-list entry are removed together; runtime implementations and tests are unchanged. Retaining the existing port is consistent with the stated decision to avoid broadening unsafe MIR support solely for this replacement, alongside the Vec::drain decision in #636.

Verification limits: GitHub-only static review of the deletion. I did not run quest validation or reproduce the prerequisite analysis, differential tests, or sibling spike's timings. No BinaryHeap performance measurement is established by this review. This is a COMMENT, not an approval.

(Written by review (OpenAI))

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Required list entry for translating BinaryHeap and PeekMut from std’s MIR was removed. The proposal describing the port, its differential fixture, and the lack of a consumer at the pinned moq revision was also removed.

Merge Risk: Minimal · up to fa6c3

This change removes the BinaryHeap MIR proposal without changing runtime behavior. No actionable merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title identifies the deleted BinaryHeap MIR quest.
Description check Passed The description identifies the quest deletion and the removal of its link.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6abe4c59-facc-4fa3-bf7f-9cb2ed2bf9dc
Commits

Reviewing files that changed from the base of the PR and between 6231cec and fa6c31f.

Files selected for processing: 2

  • quest/m3/ts-unsafe/README.md
  • quest/m3/ts-unsafe/binary-heap-mir.md
Files with no reviewable changes: 1

  • quest/m3/ts-unsafe/binary-heap-mir.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Merged via the queue into main with commit 6d8efe9 Nov 7, 2026
4 checks passed
@kixelated
kixelated deleted the quest/m3/ts-unsafe/binary-heap-mir branch November 7, 2026 15:33
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