[Solved] How to generate and load save-analysis for a single file without cargo


I’m trying to generate and load save-analysis data for a single file using the rls-analysis crate, without invoking cargo.

Here’s what I have so far:


#![crate_type = "lib"]

//! Docs.

$ rustc -Z save-analysis crate_doc.rs

This creates a folder save-analysis-temp.

Then, I have

let host = AnalysisHost::new(Target::Debug);
let path = Path::new("save-analysis-temp");
host.reload(&path, &path, true);
println!("{:?}", host.def_roots().unwrap());

However, I don’t see crate_doc in the list of crates printed. What am I doing wrong?

How to get fully qualified path to a type with syntex_syntax?

Answer here: https://github.com/nrc/rls-analysis/issues/76