Run cargo add
in c2rust-instrument --set-runtime
to add c2rust-analysis-rt
automatically
#562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, in #554, the
c2rust-analysis-rt
runtime must be added as an (optional) dependency in the instrumented crate. This runscargo add c2rust-analysis-rt --optional
so that it is automatically added and up-to-date when instrumenting. This also adds an optional--runtime ${runtime}
argument toc2rust-instrument
. If it is given, thencargo add c2rust-analysis-rt --optional --path ${runtime} --offline
is run. Thus, it works well both whenc2rust-analysis-rt
is already on your machine and you're developing locally, as well as a user who would downloadc2rust-analysis-rt
from crates.io. Note thatcargo add
is only run when--set-runtime
is passed, so this is off by default, and must be opted-into.Another, more complex, option is to copy the
Cargo.toml
to aCargo.instrument.toml
, add thec2rust-analysis-rt
dependency there, and the run with--manifest-path Cargo.instrument.toml
. However, that's more complex, and not allcargo
commands uniformly take a--manifest-path
argument, and there's no environment variable for that, which would be seamlessly inherited.