Errors compiling rust-analyzer, any version

Any version of rust-analyzer I have tried to compile (cargo clean, then cargo build --release) gets the error:

error[E0445]: private trait FileIdToSyntax in public interface
--> crates/hir-expand/src/
86 | trait FileIdToSyntax: Copy {
| -------------------------- FileIdToSyntax declared as private
107 | impl<FileId: FileIdToSyntax, T> InFileWrapper<FileId, T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait

For more information about this error, try rustc --explain E0445.

I have rustc version 1.72.1 (the one that is available on OpenBSD 7.4 stable) and have tried compiling several versions of rust-analyzer, starting before its required rustc version changed from 1.70.

For example, a commit I tried to compile but that gets this error, is 5544f4fa3. I can't compile the latest, again, because I don't have a recent enough rustc version.

I'm wondering if this has to do with the crate versions "0.0.0" listed in the Cargo.toml file. I was able to compile rust-analyzer (I think this commit or a near one) previously, but then after I tried compiling the latest version, realizing I don't have a recent enough rustc version, and then going back to trying to compile an earlier commit, I started getting these failures, even if I do "cargo clean" between each attempt.

Suggestions? thanks much!!

Try building 424da10 --- it looks like rust-vesion in Cargo.toml wasn't updated for a while, and yor commit does in fact require 1.74

In general, rust-analyzer only builds with the latest stable, so, if Cargo.toml says it builds with an eariler version as well, Cargo.toml is probably wrong.

That worked! Thank you very much.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.