0

I want to check whether a module would compile within the context of a cargo project (i.e. all the dependencies as well as the rust edition from Cargo.toml loaded). As far as I understand, with cargo check, this would only work for specified targets. Thus I could only check the compilation of the file if it were part of a target that I could build.

However, the project requires a bit of effort to set up and get running (especially since it is in an earlier development stage it doesn't really work) and currently I only want to check a single source file without a main function.

Using rustc --edition 2021 --crate-type lib path/to/file.rs only works for the basics but obviously doesn't load or link other crates (which I need).

I only found this post that explains how to manually add dependencies to rustc, which obviously isn't my preferred approach. Is there a way to check if this file would compile with all the necessary crates linked against it with cargo?

Pinko
  • 39
  • 1
  • 8

0 Answers0