Skip to content

Standard Rust setup causes full rebuild every time. Setting g:ycm_rust_toolchain_root solves the problem #4012

@JasonXJ

Description

@JasonXJ

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • [] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I
    expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key
questions:

So a few days ago I updated my rust toolchain with rustup update, and my cargo repo starts to do a full rebuild (instead of incremental build) every time. Often time, cargo build will also print "blocking waiting for file lock" at the beginning for a while. I was able to eventually solve this by manually setting g:ycm_rust_toolchain_root to the one that my system is using.

I believe the reason is that the YCM's standard rust setup is to download it own rust toolchain with a pinned version, and when this version does not match the one that your system is using, the rust-analyzer run by YCM and cargo build just keep erasing the cache and rebuild everything. Since full rebuild is slow, cargo build often time print "blocking waiting for file lock" because rust-analyzer is rebuilding everything.

I think YCM standard setup is probably a recipe for trouble. Maybe it is better to change the document to recommend pointing g:ycm_rust_toolchain_root to your system toolchain instead? And we can prompt the user when the required toolchain components (e.g. rust-src, rust-analyzer) is missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR WelcomeA good quality PR for this feature would be considered.enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions