Skip to content

Solving closure goal keeps expanding lifetimes #688

Description

@detrumi

Found in rust-analyzer#7796:
When trying to solve this goal:

Implemented({closure:ClosureId(3)}<[?0 := () for<0> [
    ?0 := (&'static 2<[?0 := ^1.0, ?1 := (&'static ^1.1)]>),
    ?1 := (&'static 2<[?0 := ^1.2, ?1 := ^1.1]>),
    ?2 := Ordering<[]>]
]> : FnMut<2<[
    ?0 := (&'static 2<[?0 := ^0.3, ?1 := ^0.4]>),
    ?1 := (&'static 2<[?0 := ^0.3, ?1 := ^0.4]>)
]>>)

Chalk keeps expanding the query when trying to normalize this:

Normalize(<{closure:ClosureId(3)}<[?0 := () for<0> [
    ?0 := (&'static 2<[?0 := ^1.0, ?1 := EXPAND_1]>),
    ?1 := (&'static 2<[?0 := ^1.36, ?1 := EXPAND_2]>),
    ?2 := Ordering<[]>]
]> as FnOnce<2<[
    ?0 := (&'static 2<[?0 := ^0.38, ?1 := EXPAND_3]>),
    ?1 := (&'static 2<[?0 := ^0.38, ?1 := EXPAND_3)]>)
]>>>::Output -> Ordering<[]>)

EXPAND_1 = (&'^1.1 (&'^1.2 (&'^1.3 ... (&'^1.34 ^1.35))))
EXPAND_2 = (&'^1.2 (&'^1.3 (&'^1.4 ... (&'^1.34 ^1.37))))
EXPAND_3 = (&'static (&'static ... (&'static ^0.39)))

It's tricky to translate the rust-analyzer example to a chalk test case because closures are involved, but hopefully this should be enough info to make the problem clear.

Activity

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

    C-chalk-recursiveIssues related to the chalk-recursive crateC-chalk-solveIssues related to the chalk-solve cratebugA bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions