This adds an MVP of a cargo wrapper for c2rust-analyze so that it can be run on a whole crate like cargo. This copies the approach from c2rust-instrument, with some minor adjustments:
We don't care about the instrumentation and metadata c2rust-instrument need, so that code is gone.
We still allow c2rust-analyze to be called as a rustc_wrapper directly. More specifically, the cargo wrapper is supposed to set RUST_SYSROOT. c2rust-instrument requires this, while c2rust-analyze will re-calculate it if it wasn't.
This allows us to keep using the rustc wrapper in tests,
as the tests are all set up as single files meant to be compiled with rustc directly.
We can change this, but that'll come later. The exception is the lighttpd_minimal and with_pdg_file tests, as those run on full crates. I converted lighttpd_minimal to use the cargo wrapper as a proof of concept to show it works. I tried to do the same for with_pdg_file, but it updated some of the hashes or something so now the PDG binary has out-of-date DefPathHashes, and I'm not sure how to regenerate a new one.
@fw-immunant, how'd you generate the reference_pdg.bc? I'd like to regenerate it so it uses up-to-date DefPathHashes, as I think dependency hashes got updated from the ones hardcoded in the test.
This adds an MVP of a
cargo
wrapper forc2rust-analyze
so that it can be run on a whole crate likecargo
. This copies the approach fromc2rust-instrument
, with some minor adjustments:c2rust-instrument
need, so that code is gone.c2rust-analyze
to be called as arustc_wrapper
directly. More specifically, thecargo
wrapper is supposed to setRUST_SYSROOT
.c2rust-instrument
requires this, whilec2rust-analyze
will re-calculate it if it wasn't.This allows us to keep using the
rustc
wrapper in tests, as the tests are all set up as single files meant to be compiled withrustc
directly. We can change this, but that'll come later. The exception is thelighttpd_minimal
andwith_pdg_file
tests, as those run on full crates. I convertedlighttpd_minimal
to use thecargo
wrapper as a proof of concept to show it works. I tried to do the same forwith_pdg_file
, but it updated some of the hashes or something so now the PDG binary has out-of-dateDefPathHash
es, and I'm not sure how to regenerate a new one.