Open aryan9600 opened 2 years ago
That looks like a rustc error, does your project build? You might need to use a path relative to OUT_DIR
or someplace else.
The error is valid, the file doesn't exist. But due to this error, rust-analyzer stops reporting diagnostics in my entire project. If I remove the include!
statement, rust-analyzer works fine. Hence, I thought it'd be a good hack to just disable all diagnostics on macros so I can have diagnostics everywhere else. Is there a better way to approach this problem?
Does cargo check
report those other errors? In a quick test, diagnostics seem to work fine:
error: couldn't read src/x.rs: No such file or directory (os error 2)
--> src/main.rs:1:1
|
1 | include!("x.rs");
| ^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `hello` due to previous error
Anyway, disabling the rust-analyzer
proc macro diagnostics won't make the cargo check
errors go away, nor will it fix any issue that prevents it from working in the presence or missing include!
s.
But maybe for you it would be easier to make sure that you include a file that exists?
I would like to disable diagnostics on all usages of
include!()
in my project, so I disabled diagnostics for macro errors by configuring this setting"rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro", "macro-error"]
as mentioned here.But rust-analyzer still performs diagnostics and reports errors: