rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.27k stars 1.61k forks source link

Chalk overflow when processing `vulkano` #11614

Open maurer opened 2 years ago

maurer commented 2 years ago

rust-analyzer version: rust-analyzer 4e72700 2022-03-02 dev

rustc version: rustc 1.61.0-nightly (8769f4ef2 2022-03-02)

Upon attempting to load vulkano:

mmaurer@curtana:~/Development/rust$ git -C vulkano/ log -1
commit 6061fb738a19c3c435dbd6c7325bc287dcdd778f (HEAD -> master, origin/master, origin/HEAD)
Author: Rua <ruawhitepaw@gmail.com>
Date:   Mon Feb 28 09:40:58 2022 +0100

    #1852 changelog
mmaurer@curtana:~/Development/rust$ rust-analyzer --version
rust-analyzer 4e72700 2022-03-02 dev
mmaurer@curtana:~/Development/rust$ rust-analyzer analysis-stats vulkano 2> analysis-err.log
2151/3360 64% processing: pipeline::graphics::vertex_input::collection::tests::vertex_buffer_collectio668/3360 79% processing: command_buffer::sys::bind_descriptor_setsmmaurer@curtana:~/Development/rust$

Error output: analysis-err.log

This indicates that chalk is overflowing when processing vulkano. This starts happening as of the rust-analyzer based on compiler 1.59 (worked in 1.58), and continues through present nightly.

Setting CHALK_OVERFLOW_DEPTH=400 allows the process to complete successfully:

mmaurer@curtana:~/Development/rust$ CHALK_OVERFLOW_DEPTH=400 rust-analyzer analysis-stats vulkano
Database loaded:     1.16s, 244minstr (metadata 701.59ms, 17minstr; build 208.16ms, 9484kinstr)
  crates: 39, mods: 321, decls: 4476, fns: 3360
Item Collection:     17.49s, 95ginstr
2151/3360 64% processing: pipeline::graphics::vertex_input::collection::tests::vertex_buffer_collectio3310/3360 98% processing: command_buffer::validity::copy_image_buffer::tests::test_required_len_for_fo1/3360 98% processing: command_buffer::validity::copy_image_buffer::tests::test_required_len_for_forma3/3360 98% processing: command_buffer::validity::clear_depth_stencil_image::check_clear_depth_stencil_4/3360 98% processing: command_buffer::validity::clear_depth_stencil_image::check_clear_depth_stencil_  exprs: 272464, ??ty: 1612 (0%), ?ty: 698 (0%), !ty: 311
Inference:           54.16s, 268ginstr
Total:               71.66s, 363ginstr
mmaurer@curtana:~/Development/rust$

I have not minimized the CHALK_OVERFLOW_DEPTH and do not know what the threshold is for it beginning to work.

I don't know enough about what chalk is doing around processing bind_descriptor_sets to know whether this is a bug in how it's being processed, or if this just means that real world libraries need a larger default overflow depth.

maurer commented 2 years ago

In case it's helpful, vulkano::command_buffer::sys::bind_descriptor_sets is the function it's breaking the overflow depth on.