-
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
'overflow depth reached' panic during syntax highlighting, when using aes + ctr + cipher #11370
Comments
does not fix this |
I have further reduced this to use cipher::NewCipher;
type Aes128Ctr = ctr::Ctr64BE<aes::Aes128>;
pub fn make_ra_unhappy() {
let zeroes = [0; 16].into();
let _cipher = Aes128Ctr::new(&zeroes, &zeroes);
} and updated the git repo. |
This alternative works without issues in rust-analyzer: [dependencies]
aes = { version = "0.7", features = ["ctr"] }
cipher = "0.3" use aes::Aes128Ctr;
use cipher::NewCipher;
pub fn fail_to_make_ra_unhappy() {
let zeroes = [0; 16].into();
let _cipher = Aes128Ctr::new(&zeroes, &zeroes);
} |
+1 Ran into the same issue, I was able to mitigate it by changing my rust-analyzer version in VSCode to |
aes 0.8 was released and it no longer has the |
Going back to rust-analyzer version |
Same issue here, I've reverted to v0.2.853 in VSCode. |
This issue is still present in d312b45. It was introduced in 851af5a, which was fixing #11072 in PR #11074. Using the latest rust-analyzer with the old CHALK_SOLVER_MAX_SIZE=30 value fixes this issue, but presumably causes #11072 again. CHALK_SOLVER_MAX_SIZE=108 is as high as I could go without causing "server panicked: overflow depth reached, check the log" on x86_64 NixOS 21.11. I will open a PR with CHALK_SOLVER_MAX_SIZE=100 which will hopefully be suitable. |
The repro in https://github.com/ludios/ra-chalk-overflow-bug works for me with |
@lnicola It looks like I minimized https://github.com/ludios/ra-chalk-overflow-bug to excess. For the code I originally posted in the issue, now in https://github.com/ludios/ra-chalk-overflow-bug-2, there doesn't appear to be any |
I think that repo might be private. |
Fixed, sorry about that. |
Exactly same issue when working with RustCrypto and Rust-Analyzer.
Here is my reproduction code: fn main() {
use cipher::{BlockDecryptMut, KeyIvInit};
let zeros = [0; 16].into();
let mut decryptor = cbc::Decryptor::<aes::Aes128>::new(&zeros, &zeros);
decryptor. // rust-analyzer panicked here.
} Modifying And the output of rust-analyzer shows it just stack overflowed.
|
@ivan can you try $ rust-analyzer analysis-stats .
Database loaded: 796.89ms, 92minstr (metadata 571.68ms, 5080kinstr; build 181.78ms, 1608kinstr)
crates: 1, mods: 1, decls: 2, fns: 1
Item Collection: 3.08s, 32ginstr
exprs: 15, ??ty: 2 (13%), ?ty: 4 (26%), !ty: 1
Inference: 4.59s, 35ginstr
Total: 7.67s, 67ginstr
$ CHALK_OVERFLOW_DEPTH=300 rust-analyzer analysis-stats .
Database loaded: 477.88ms, 92minstr (metadata 379.25ms, 5086kinstr; build 55.58ms, 1615kinstr)
crates: 1, mods: 1, decls: 2, fns: 1
Item Collection: 3.14s, 32ginstr
0/1 0% processing: stream_chunksthread 'main' panicked at 'overflow depth reached', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-recursive-0.82.0/src/fixed_point/stack.rs:51:13
stack backtrace:
0: std::panicking::begin_panic
1: chalk_recursive::fixed_point::stack::Stack::push
2: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
3: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
4: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
5: chalk_recursive::solve::SolveIteration::solve_iteration
6: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
7: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
8: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
9: chalk_recursive::solve::SolveIteration::solve_iteration
10: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
11: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
12: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
13: chalk_recursive::solve::SolveIteration::solve_iteration
14: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
15: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
16: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
17: chalk_recursive::solve::SolveIteration::solve_iteration
18: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
19: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
20: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
21: chalk_recursive::solve::SolveIteration::solve_iteration
22: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
23: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
24: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
25: chalk_recursive::solve::SolveIteration::solve_iteration
26: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
27: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
28: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
29: chalk_recursive::solve::SolveIteration::solve_iteration
30: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
31: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
32: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
33: chalk_recursive::solve::SolveIteration::solve_iteration
34: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
35: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
36: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
37: chalk_recursive::solve::SolveIteration::solve_iteration
38: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
39: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
40: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
41: chalk_recursive::solve::SolveIteration::solve_iteration
42: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
43: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
44: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
45: chalk_recursive::solve::SolveIteration::solve_iteration
46: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
47: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
48: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
49: chalk_recursive::solve::SolveIteration::solve_iteration
50: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
51: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
52: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
53: chalk_recursive::solve::SolveIteration::solve_iteration
54: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
55: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
56: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
57: chalk_recursive::solve::SolveIteration::solve_iteration
58: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
59: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
60: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
61: chalk_recursive::solve::SolveIteration::solve_iteration
62: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
63: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
64: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
65: chalk_recursive::solve::SolveIteration::solve_iteration
66: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
67: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
68: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
69: chalk_recursive::solve::SolveIteration::solve_iteration
70: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
71: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
72: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
73: chalk_recursive::solve::SolveIteration::solve_iteration
74: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
75: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
76: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
77: chalk_recursive::solve::SolveIteration::solve_iteration
78: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
79: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
80: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
81: chalk_recursive::solve::SolveIteration::solve_iteration
82: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
83: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
84: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
85: chalk_recursive::solve::SolveIteration::solve_iteration
86: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
87: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
88: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
89: chalk_recursive::solve::SolveIteration::solve_iteration
90: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
91: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. It also seems to work in Code, although we show an invalid type mismatch error. @xr1s that's a different issue. |
@lnicola You are correct. The official rust-analyzer binary appears to be working fine with https://github.com/ludios/ra-chalk-overflow-bug-2. The one I compile myself still results in 'overflow depth reached' in vscode. Sorry that I did not test earlier, I didn't expect a difference. I will go try to figure out why that happens. Oddly, my build doesn't crash when running
|
The rust-analyzer stack overflows occur with https://github.com/ludios/ra-chalk-overflow-bug-2 only when rust-analyzer is compiled with lto: diff --git a/Cargo.toml b/Cargo.toml
index 6b68ca823..7438b861d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,8 @@ miniz_oxide.opt-level = 3
incremental = true
# Set this to 1 or 2 to get more useful backtraces in debugger.
debug = 0
+lto = true
+codegen-units = 1
[patch.'crates-io']
# rowan = { path = "../rowan" } I thought that the CI-built rust-analyzer was being compiled with full lto, so I did not suspect this as a cause earlier. It looks like it was changed to |
Regarding the build size, I tested the following configurations:
The full LTO build (at least) crashes for me with:
But this is a different error from the original one (same that xr1s saw earlier). |
Increase worker thread stack and name them CC #11370
Been dealing with this same type of issue in pretty much any Substrate project I've worked on. I documented some of it here, but haven't found a solution yet https://www.reddit.com/r/rust/comments/w9prbu/rust_analyzer_tooltips_hardly_ever_work_wsubstrate/. I particularly have issues when working in this repository: https://github.com/InvArch/InvArch-Frames |
rust-analyzer version: 6634eaf 2022-01-29 nightly
rustc version: rustc 1.60.0-nightly (e0a55f449 2022-01-28)
Hello,
I am having a problem with rust-analyzer being unable to syntax-highlight my project. This project builds successfully on Rust nightly with
cargo build
.So far I have reduced the issue to:
(available in this repo with a Cargo.toml)
rust-analyzer shows these messages when clicking around in
lib.rs
:I used rust-analyzer v0.3.921 in vscode 1.63.2 and tested with rustc nightly-2022-01-27 on NixOS and rustc nightly-2022-01-28 on Windows 10, both of which do the same thing.
There are other variations that will have the same problem, including
()
->String
,#[stream]
->#[try_stream]
, andasync
->async move
.The output in vscode shows:
The text was updated successfully, but these errors were encountered: