Skip to content

Commit 766c74f

Browse files
shuaimuclaude
andcommitted
docs: refresh TODO-misc.md — matrix now 14/15, audit per-item status
The doc was last updated when the matrix was 11/15 and reflected the inference-engine planning era. Refresh to the current state: - Header: 11/15 → 14/15 (only itertools remains) - Add session log (newest first) summarizing the two most recent sessions: 11/15 → 13/15 (either + serde via inference engine end-to-end) and 13/15 → 14/15 (serde_bytes via crate namespacing Phase 1, plus four converging itertools fixes). - Mark items 1, 2a, 2c, 2d, 2e, 2f, 3, 4, 5, 7 as done with commit references. Item 6 (universal crate namespacing Phase 2) is documented as optional — Phase 1 sufficient for current matrix. - Add §2b-ii (the requires-clause cross-pass alignment blocker) with full root-cause analysis: pre-pass forward decl produces unqualified `typename I::Item` while final pass produces qualified `typename ::combinations:: PoolIndexTraits<I>::Item` because the trait isn't yet registered when pre-pass map_type runs. - Document the pre-collect approach attempted and reverted this session — registering all traits' assoc-types recursively before the pre-pass made the lookup succeed but over-registered, regressing `adaptors::coalesce::Count ItemTraits<C>::CItem` because `coalesce` at the use site is a function template name that shadows the namespace during ambient lookup. - Path forward: per-use-site qualification check or pre-collect with conflict detection — both require building a per-scope symbol table the transpiler doesn't have yet. This is documentation only — no code changes. The session's work this iteration was an experimental pre-collect that got reverted; the doc captures what was learned so the next attempt at item 2b-ii starts from the correct baseline. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent eb606e8 commit 766c74f

1 file changed

Lines changed: 70 additions & 11 deletions

File tree

docs/TODO-misc.md

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# TODO: Plan for Remaining Parity-Matrix Failures
22

3-
Status at time of writing: **11 / 15 PASS** — arrayvec, bitflags, cfg-if, once_cell, pollster, semver, **serde_core** (new — unlocked by the variant_holds-via-variant_ctx fix in commit 2cc52b6), serde_repr, smallvec, take_mut, tap.
3+
Status (as of 2026-06-11): **14 / 15 PASS** — arrayvec, bitflags, cfg-if, **either** (flipped, commit bb255fa), once_cell, pollster, semver, **serde** (flipped, commit 1ff08d7), **serde_bytes** (flipped, commit 064a6cc), serde_core, serde_repr, smallvec, take_mut, tap.
44

5-
Remaining failures: `either`, `itertools`, `serde_bytes`, `serde`.
5+
Remaining failure: **`itertools`** only.
66

77
This document captures the per-crate failure analysis, fix proposals, and recommended ordering. Each item is sized in rough-day units; treat as a working plan rather than a contract.
88

9+
## Session log (newest first)
10+
11+
- **2026-06-11**: Matrix advanced 13/15 → 14/15. serde_bytes flipped via crate-namespacing wrap (Phase 1, narrow — commit 064a6cc). itertools advanced 5 unique errors → 1 via four converging fixes: by-value `auto` for non-reference params, supertrait inheritance skip when parent has assoc types, `<Trait>Traits` helper qualification with home namespace, `ArrayRepeatResult` template `operator=`.
12+
- **2026-06-10**: Matrix advanced 11/15 → 13/15. either + serde flipped via inference engine end-to-end (Phases 1-5) + emit-site wiring + `value.into()` slice routing + `Vec::from(span)`.
13+
914
---
1015

1116
## 1. `either` — Either_Left / Either_Right CTAD failure
@@ -187,17 +192,71 @@ This wouldn't run a real executor (we'd still need `Future::poll` machinery), bu
187192
188193
| # | Item | Status | Cost | Unlocks |
189194
|---|---|---|---|---|
190-
| 1 | ~~Perf track for serde_core~~ | ✅ done (matrix `--release`) | ~0.5 day | 4 crates from "can't test" → "can test" |
191-
| 2a | ~~itertools `tee` ↔ POSIX `tee()` collision~~ | ✅ done (mod rename) | ~5 min | itertools' first build blocker |
192-
| 2b | itertools `PoolIndexTraits` qualification | ⏳ partial — needs design (see §2b) | ~1 day | second build blocker on itertools |
193-
| 3 | either approach A | ⏳ deferred — see §A note (insufficient by itself) | ~1.5 day | either + future data-enum cases |
194-
| 4 | serde-family correctness | ⏳ (now reachable) | ~1 day | serde_bytes likely passes; serde_repr/serde_core/serde may pass or surface new issues |
195-
| 5 | itertools 2c | ⏳ | variable | itertools build complete |
196-
| 6 | pollster | ⏳ optional | ~1 day | pollster build (no runtime guarantee) |
195+
| 1 | ~~Perf track for serde_core~~ | ✅ done (matrix `--release`) | — | — |
196+
| 2a | ~~itertools `tee` ↔ POSIX `tee()` collision~~ | ✅ done (mod rename) | — | — |
197+
| 2b-i | ~~itertools `PoolIndexTraits` qualification~~ | ✅ done (commit 2f9c570 — qualified emit at `mod.rs:32228` via `trait_declared_path_by_short_name`) | — | 6 "no template named" errors cleared |
198+
| 2b-ii | itertools requires-clause cross-pass alignment | ⏳ blocked — needs trait-uniqueness-by-use-context logic | ~2 days | last itertools error type clears |
199+
| 2c | ~~itertools `make_entry_probe`~~ | ✅ no longer surfacing | — | — |
200+
| 2d | ~~itertools const-binding mutability~~ | ✅ done (commit bb3887d — by-value Rust params lower as `auto`) | — | itertools `sub_scalar` compiles |
201+
| 2e | ~~itertools supertrait assoc-types inheritance~~ | ✅ done (commit 49ccd98 — supertrait skipped when parent has assoc types) | — | `HomogeneousTuple: TupleCollect` compiles |
202+
| 2f | ~~itertools `ArrayRepeatResult = Vec` assignment~~ | ✅ done (commit eb606e8 — templated `operator=` on any iterable) | — | itertools `test_checked_binomial` compiles |
203+
| 3 | ~~either approach A — emit-side wiring~~ | ✅ done (commit bb255fa — explicit template args on variant ctors via inference engine output) | — | either flips |
204+
| 4 | ~~serde-family correctness~~ | ✅ done (commit 1ff08d7 — slice routing + `Vec::from(span)` + `into_boxed_slice`) | — | serde flips |
205+
| 5 | ~~serde_bytes namespacing~~ | ✅ done (commit 064a6cc — Phase 1 narrow wrap) | — | serde_bytes flips |
206+
| 6 | Universal crate namespacing (Phase 2) | ⏳ optional — Phase 1 sufficient for current matrix | ~1.5 days | future cross-crate trait collisions |
207+
| 7 | ~~pollster~~ | ✅ passes (was never failing — earlier session) | — | — |
208+
209+
**Achieved outcome:** 5 → 14 / 15 across two sessions. Only itertools' requires-clause-differs cross-pass alignment remains as a known blocker.
210+
211+
**Validation gate at each step:** run the 14 currently-passing crates to confirm no regression before moving to the next item.
212+
213+
## §2b-ii: requires-clause cross-pass alignment (remaining work)
214+
215+
**Symptom**
216+
217+
itertools' `CombinationsWithReplacement<I>` has two forward declarations and one struct body:
218+
219+
```cpp
220+
// pre-pass forward decl (cppm:4231):
221+
export template<typename I>
222+
requires (std::copyable<typename I::Item>)
223+
struct CombinationsWithReplacement;
224+
225+
// final-pass forward decl + struct body (cppm:9633, 9657):
226+
export template<typename I>
227+
requires (std::copyable<typename ::combinations::PoolIndexTraits<I>::Item>)
228+
struct CombinationsWithReplacement;
229+
```
230+
231+
C++ rejects: `requires clause differs in template redeclaration`.
232+
233+
**Root cause**
234+
235+
`lookup_unique_trait_for_assoc_name("Item")` returns:
236+
- During pre-pass forward decl: `None` (the trait `PoolIndex` isn't yet registered in `trait_associated_type_names`).
237+
- During final pass: `Some("PoolIndex")` (the trait's body emit registered it before the requires clause is mapped).
238+
239+
The pre-pass therefore falls through to bare `typename I::Item`, while the final pass uses the qualified `typename ::combinations::PoolIndexTraits<I>::Item` form.
240+
241+
**Why a simple pre-collect doesn't work**
242+
243+
Tried (this session, reverted): a recursive pre-collect that walks `Items` and populates `trait_associated_type_names` for every trait before the forward-decl pre-pass runs. This made the lookup succeed during pre-pass too — both passes produced the qualified form.
244+
245+
**But** it regressed a different itertools site (`adaptors::coalesce::CountItemTraits<C>::CItem`). The pre-collect over-registered traits whose qualified path passes through a segment (`coalesce`) that is *also* a function template name at the use site. Ambient lookup at the use site finds the function first and shadows the namespace, producing `'coalesce' is not a class, namespace, or enumeration`.
246+
247+
The final-pass machinery doesn't hit this bug because it selectively registers traits in a way that avoids these conflicts — exact selection rules not yet traced.
248+
249+
**Path forward (estimated 2 days)**
250+
251+
Option A: Per-use-site qualification check. At each `typename FooTraits<X>::Y` emit, verify that the qualified path resolves uniquely in the use site's lexical scope. Fall back to `typename X::Y` (unqualified) when the qualified form would be shadowed.
252+
253+
Option B: Pre-collect with conflict detection. The pre-pass registers a trait's assoc types only if all segments of its qualified path are exclusively namespaces in the use site's reachable scope (i.e., no function-template or type-alias collisions).
254+
255+
Both require building a per-scope symbol table — fundamentally a name-resolution pass that the transpiler currently doesn't have at this level of fidelity.
197256

198-
**Expected outcome if 1–4 land:** ~11–12 / 15. either + itertools at least build; serde_bytes likely passes; the rest of serde-family is uncertain.
257+
**Workaround until then**
199258

200-
**Validation gate at each step:** run the 8 currently-passing crates to confirm no regression before moving to the next item.
259+
Itertools stays as the one matrix failure. The remaining error is genuine cross-pass divergence — not a regression and not a correctness issue with any of the 14 passing crates.
201260

202261
---
203262

0 commit comments

Comments
 (0)