Skip to content

ICE: slicing a list element in place (parts[0][..n]) — "slice base does not resolve to a concrete place type" #2578

Closed

Description

@ehartford

Four lines, on the pinned seed (nightly-20261020-local-3) and on main 285c495's installed compiler alike:

fn main:
    let parts: List[str] = ["ab:cd"]
    let colon = parts[0].find(":")
    print(parts[0][..colon])
error: internal compiler error: invalid MIR before codegen (a bug in the With compiler, not in this program): slice base does not resolve to a concrete place type in `main`
 --> slice_elem.w:4:11

parts[0] is a &str element place (D27); a slice of it is a slice of a place like any other. Binding it first (let segment: str = parts[0]; segment[..colon]) compiles. Found writing ci_generic_selection_selected (CImport.w), whose segment slicing now goes through a binding; the route is --dump-mir of main (the slice statement's base operand) then the slice lowering in MirLower.

Activity

  1. ehartford commented on Oct 23, 2026

    @ehartford
    ContributorAuthor

    Fixed in #2580 (c7fa606): the lowering read through a reference whenever Sema's type of the base expression was a reference; an element place is typed as a view but its MIR place is the element. The place's own type decides now (MirLower.place_holds_reference). Fixture behav_2578 covers a list element, an array element, a slice element, a nested list, rest(), first() and a for loop.

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