Skip to content

trait solver hangs for recursively expanding coinductive cycles #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lcnr opened this issue May 8, 2023 · 0 comments
Open

trait solver hangs for recursively expanding coinductive cycles #13

lcnr opened this issue May 8, 2023 · 0 comments
Labels
A-coinduction A-overflow Having to do with overflow

Comments

@lcnr
Copy link
Contributor

lcnr commented May 8, 2023

#![feature(rustc_attrs)]

#[rustc_coinductive]
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{
}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>();
}

this hangs in the new solver.

we start with a coinductive cycle of length 1 and 2 nested goals, then the next cycle is of length 2 with 4 nested goals, then length 3 with 8 nested goals. This is an example which should result in overflow while only slowly growing the recursion depth.

i think we generally want some general "overflow counter" in the search graph. For this to be sound wrt to caching hitting that limit may have to be fatal or we include the steps taken in the query response 🤷 we will figure it out

@lcnr lcnr added the A-overflow Having to do with overflow label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coinduction A-overflow Having to do with overflow
Projects
None yet
Development

No branches or pull requests

1 participant