Skip to content

Endless loop in recursive solver #667

@flodiebold

Description

@flodiebold
#[test]
fn endless_loop() {
    test! {
        disable_coherence;
        program {
            trait FnOnce {
                type Output;
            }

            struct MyClosure<F> {}
            impl<T> FnOnce for MyClosure<fn() -> T> {
                type Output = T;
            }
        }
        goal {
            exists<T> {
                <MyClosure<fn() -> T> as FnOnce>::Output = T
            }
        } yields[SolverChoice::recursive_default()] {
            "Unique; for<?U0> { substitution [?0 := ^0.0], lifetime constraints [] }"
        }
    }
}

This hangs forever in the recursive solver; in the SLG solver, it results in Ambiguous; no inference guidance, which seems wrong as well? Replacing fn() -> T by T makes the test succeed (in both solvers).

CC rust-lang/rust-analyzer#6945.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-chalk-solveIssues related to the chalk-solve crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions