Skip to content

Indexing through a view of a view (v: &&Vec[T]) fails: 'cannot infer type parameter' / MIR 'index expression has no Sema element type' #2189

Closed

Description

@ehartford
enum Src ephemeral:
    One(&Vec[str])
let xs: Vec[str] = ["a".to_owned(), "b".to_owned()]
let s: Src = .One(&xs)
match &s:
    .One(v) => print(v[1])

Expected: b.
Actual: a Sema error, or an ICE in MIR (index expression has no Sema element type). check_index peels one reference; MIR already peels every one. Matching a view payload through a view of its enum binds &&Vec[T].

Activity

  1. ehartford commented on Oct 5, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by stack #2196 (merged as efb765c), battery green on a21e326; the regression test for it landed with the fix.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions