Skip to content

§11.7: MultiIndex trait signature fails without explicit IndexSpec import, and IndexSpec is a flat struct instead of the spec's enum #3047

Closed

Description

@ehartford

Found during the #2987 manual audit of docs/spec/011_traits.md (§11.7, lines 382–387).

Gaps

  1. Implementing prelude trait MultiIndex[O] in user code without use std.collections.IndexSpec errors inside <embedded-std>/std/traits.w:383:
    error: 'IndexSpec' requires an explicit import (§18.1); add: use std.collections.IndexSpec
     --> <embedded-std>/std/traits.w:383:42
    383 |     fn multi_index(self: &Self, specs: &[IndexSpec], count: i32) -> O
    
    A prelude trait's own signature types must resolve in <embedded-std>/std/traits.w's scope (and IndexSpec be reachable wherever MultiIndex is).
  2. Spec §11.7 (011_traits.md:382-387) specifies IndexSpec as an enum:
    IndexSpec.Scalar(expr)
    IndexSpec.Slice(start?, stop?, step?)
    IndexSpec.Ellipsis
    IndexSpec.NewAxis
    
    whereas lib/std/collections.w:1074 exposes a flat struct { kind: i32, start: i64, stop: i64, step: i64, has_start: bool, has_stop: bool, has_step: bool }.

Activity

  1. added
    spec-gap
    on Nov 5, 2026
  2. added a commit that references this issue on Nov 6, 2026
  3. ehartford commented on Nov 6, 2026

    @ehartford
    ContributorAuthor

    Gap 1 fixed in #3054 (merged as 12489f1): a trait default method's parameter types resolve in the trait's own module (D140). Gap 2 stays open for Eric.

  4. ehartford commented on Nov 7, 2026

    @ehartford
    ContributorAuthor

    Gap 2 (IndexSpec as the spec's enum) is the next layer: codegen lays the record out by hand (mir_build_multi_index_specs_ref), so the enum needs MirLower to build real IndexSpec values and codegen to drop the hand layout, plus the std declaration and both fixtures. Not in #3056.

  5. added a commit that references this issue on Nov 7, 2026
  6. ehartford commented on Nov 7, 2026

    @ehartford
    ContributorAuthor

    Gap 2 fixed in #3058 (merged as f8b8d8d): IndexSpec is the spec's enum, MIR builds the specs, codegen no longer lays the record out by hand. Gap 1 landed in #3054.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions