Hello.
I'm looking to use rustc_interface and rustc_driver for analysis of rust crates. I got my code working for single-file programs, but I am struggling to find a way to get it to work with an entire crate with multiple files. I have no prior experience with rustc internals, so any help will be appreciated.
I've put together small program based off of this example and information from the rustc-dev-guide. My code is almost identical to the example except for the custom analysis that runs on function signatures, so I will omit for now.
Naively pointing the input to src/lib.rs results in a runtime error because rustc doesn't have enough information about dependencies and library specific types/functions to type check lib.rs. As far as I can see from the type signature of input, it is not possible to pass in multiple files. Therefore, I would most likely need to compile various dependencies and source files in the way cargo compiles a crate. Is there a separate library to do this? (I haven't found one after googling for 30 minutes, so maybe it's not well known?) Otherwise, is it possible to the same thing with rustc_interface and rustc_driver and chain together the type context?
I have tried a few other static analysis tools for crates, but they were missing key information, so the rustc_interface/driver are kind of a last resort for me.
Thank you for your time.