-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c2rust-analyze
: Add a cargo
wrapper
#1036
Conversation
@fw-immunant, how'd you generate the |
d62b187
to
afd03d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once comments are addressed. Where there is ambiguity I would prefer the documentation be changed, not just PR comments to clarify.
afd03d3
to
c05209b
Compare
…nstead of `if cfg!(unix)`.
It was tricky to get exactly the right ones with the right MSRV.
…rgo` on a whole crate. This copies the approach from `c2rust-instrument`. The main difference are: * We don't care about the instrumentation and metadata `c2rust-instrument` need. * 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. For full crates we test like `lighttpd-minimal`, we'll definitely switch to the `cargo` wrapper, at the very least for a proof of concept.
…e the `cargo` wrapper. This is done mostly as a proof of concept for now. Ideally we'd want to add it as a method on `Analyze`/`FileCheck` and handle error reporting better. Now that `lighttpd-minimal` is run with `cargo`, we don't need the `extern crate libc;` anymore.
c05209b
to
f071ea7
Compare
c2rust-analyze
be acargo
andrustc
wrapper likec2rust-instrument
is now #709.if cfg!(unix)
mis-usages #708.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 with
rustc
directly.We can change this, but that'll come later. The exception is the
lighttpd_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.