rust-lang / rls

Repository for the Rust Language Server (aka RLS)
Other
3.52k stars 257 forks source link

ERROR rls::build::cargo_plan] Modified file XXX didn't correspond to any buildable unit! #1730

Open cjwcommuny opened 3 years ago

cjwcommuny commented 3 years ago

I encountered this error when implement a rust extension:

[2021-04-22T02:35:55Z ERROR rls::build::cargo_plan] Modified file /Volumes/Macintosh HD/Users/XXX/Downloads/hello_cargo/src/main.rs didn't correspond to any buildable unit!

The error comes from here.

The error occurs because the path of modified file is /Volumes/Macintosh HD/Users/XXX/Downloads/hello_cargo/src/main.rs but the the src_dir (see here) is something like /XXX/Downloads/hello_cargo/src/, so they don't have the same prefix. But actually, /Volumes/Macintosh HD is just a symlink to /.

Possible solution: canonicalize the path of the modified file first, and then compare the path with the src_dir. Maybe someone can fix it ? (I'm not familiar with the codebase, otherwise I can make a pull request)

williamleuschner commented 3 years ago

I'm also experiencing this issue, it would be great if someone with more Rust knowledge could take a look at it.