-
Notifications
You must be signed in to change notification settings - Fork 1.7k
async_trait analyzing error: Request codeLens/resolve failed: overflow depth reached #11668
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
Comments
This takes a minute or two to crash. Interestingly, it appears to work when replacing the proc macro with its output. |
On a second try, I can no longer reproduce the crash. The huge amount of references seems legit (they're references to random stuff like |
Why would we find any references to |
The identifier's span is being re-used by almost everything the macro expands to, so we resolve it to all of those things as well. We should probably do some filtering on the downmapped tokens, depending on the source token's kind and its usage in the source here. |
Yeah. Does it even make sense to look for references to any downmapped tokens that don't textually match the original one? |
Not necessarily no, there are a lot more IDE features (if not actually all?) where filtering like this would make sense as well. That aside I do wonder how that could trigger an overflow depth error 🤔 |
I think the original error is probably unrelated to this (or just triggered by a more-legitimate reference search for different symbol). |
I'm having what seems to be a similar issue:
This happens when I Cmd-click an impl method in my sizable (unfortunately proprietary) workspace. |
I also have this question when I use workspace with vscode between my project and tower crate: Panic context:
>
version: 46d7ee68f 2022-04-04 stable
request: textDocument/codeAction CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/Users/runner/workspace/conn-pool/src/balance.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 25,
character: 43,
},
end: Position {
line: 25,
character: 43,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
thread '<unnamed>' panicked at 'overflow depth reached', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-recursive-0.81.0/src/fixed_point/stack.rs:51:13
stack backtrace:
0: std::panicking::begin_panic
1: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
2: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
3: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
4: chalk_recursive::solve::SolveIteration::solve_iteration
5: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
6: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
7: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
8: chalk_recursive::solve::SolveIteration::solve_iteration
9: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
10: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
11: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
12: chalk_recursive::solve::SolveIteration::solve_iteration
13: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
14: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
15: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
16: chalk_recursive::solve::SolveIteration::solve_iteration
17: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
18: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
19: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
20: chalk_recursive::solve::SolveIteration::solve_iteration
21: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
22: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
23: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
24: chalk_recursive::solve::SolveIteration::solve_iteration
25: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
26: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
27: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
28: chalk_recursive::solve::SolveIteration::solve_iteration
29: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
30: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
31: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
32: chalk_recursive::solve::SolveIteration::solve_iteration
33: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
34: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
35: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
36: chalk_recursive::solve::SolveIteration::solve_iteration
37: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
38: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
39: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
40: chalk_recursive::solve::SolveIteration::solve_iteration
41: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
42: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
43: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
44: chalk_recursive::solve::SolveIteration::solve_iteration
45: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
46: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
47: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
48: chalk_recursive::solve::SolveIteration::solve_iteration
49: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
50: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
51: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
52: chalk_recursive::solve::SolveIteration::solve_iteration
53: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
54: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
55: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
56: chalk_recursive::solve::SolveIteration::solve_iteration
57: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
58: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
59: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
60: chalk_recursive::solve::SolveIteration::solve_iteration
61: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
62: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
63: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
64: chalk_recursive::solve::SolveIteration::solve_iteration
65: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
66: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
67: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
68: chalk_recursive::solve::SolveIteration::solve_iteration
69: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
70: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
71: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
72: chalk_recursive::solve::SolveIteration::solve_iteration
73: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
74: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
75: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
76: chalk_recursive::solve::SolveIteration::solve_iteration
77: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
78: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
79: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
80: chalk_recursive::solve::SolveIteration::solve_iteration
81: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
82: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
83: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
84: chalk_recursive::solve::SolveIteration::solve_iteration
85: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
86: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
87: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
88: chalk_recursive::solve::SolveIteration::solve_iteration
89: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
90: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
91: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. |
fix: Do reference search on all downmapped tokens with the same kind only cc #11668
I can't reproduce this crash any more. If you're still seeing this, can you try to bump "rust-analyzer.server.extraEnv": {
"CHALK_OVERFLOW_DEPTH": "500"
} |
Increase defalt chalk overflow depth to match max solver size TBC: - #12279: ok above 480 - ~~#12182~~ - ~~#12095~~ - #11902: ok above 350 - ~~#11668~~ - #11370: ok above 450 - #9754: probably ok above 250 (!), and the code in cause and branch are gone Closes #12279 Closes #11902 Closes #11370 Closes #9754
Hi, @lnicola thanks for your reply! For release version For pre-release version This trait can't have so much references. |
I updated to release version |
Thanks for testing. Yeah, so the crash is gone, but the references lens is bogus. use async_trait::async_trait;
#[async_trait]
pub trait TestTrait {
async fn test1(&mut self);
async fn test2(&mut self);
}
fn main() {} |
You are right, lol. But I think the crash is gone is only because the overflow depth has been increased? There's nothing changed, because previously it also doesn't crash in such simple cases. |
Try it on your larger project. If it still crashes, you can increase the overflow depth a bit more. |
Ok, thanks! What about the bogus references lens? |
That's unrelated, and arguably a bug in |
Thanks! So this is a bug in |
No, we should probably be more resilient to macros doing this. |
rust-analyzer version: 5fae65d 2022-03-07 stable
os: macOS 12 aarch64
rustc version: rustc 1.59.0 (9d1b2106e 2022-02-23)
Code:

Error Screenshot:

Error log:
And for a POC, I wrote a simple code like this:

Mention the huge amount of references here.
The text was updated successfully, but these errors were encountered: