-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RA extension completely freezes in VS Code when using fn-memo crate #7906
Comments
Can reproduce |
Root source of the bug seems to be the |
Reduced to: pub trait RecurFn<Arg, Output> {
fn body(&self, recur: impl Fn(Arg) -> Output, arg: Arg) -> Output;
fn call(&self, arg: Arg) -> Output;
}
pub struct Closure<F>(F);
impl<Arg, Output, F> RecurFn<Arg, Output> for Closure<F>
where
F: Fn(&dyn Fn(Arg) -> Output, Arg) -> Output,
{
fn body(&self, recur: impl Fn(Arg) -> Output, arg: Arg) -> Output {
self.0(&recur, arg)
}
fn call(&self, arg: Arg) -> Output {
self.0(&|arg| self.call(arg), arg)
}
} Seems to hang in chalk, not rust-analyzer. cc @flodiebold |
This hangs on a
|
Yeah, and it's really annoying that we can't easily reproduce these in the Chalk test harness... Might this be rust-lang/chalk#688 again? |
I was going to say no, but looking at it a bit more it does start creating longer goals:
So it probably is another instance of the same problem. |
It would be nice to get better debug output about the closure - closure kind, inputs/output getting lowered, upvars. I'm actually looking into rust-lang/chalk#688 right now and having a hard time reproducing |
That's in the |
I ran into various issues while trying to use this crate. As soon as I import the crate and start using functions/types from it, RA gets stuck on formatting when trying to save the file. After that the extension becomes unusable, syntax highlighting is broken, formatting is broken, code navigation is broken, run/debug button don't work, etc. Tried to restart server but no luck, only way seems to be to close and restart VS Code, but same problem is encountered again as soon as the same file is edited and/or saved.
My guess is that the root of the problem might be related to recursive closures analysis, which fn-memo (and its dependency recur-fn) are about. But can't be sure.
Windows WSL2 Ubuntu
rust-analyzer version: 2021-03-01 (5df3ee8)
Cargo TOML:
Minimal example. A lib project only having lib.rs containing the following:
The text was updated successfully, but these errors were encountered: