Conversation
Contributor
|
I don't think we should automatically run |
…is-rt` instead of the user having to manually do it. However, we have to use `+stable` as `cargo add` was added in 1.62 (on 1.60 now, but upgrading in #513).
…that they work correctly always.
e89e468 to
8d2cc30
Compare
…rgo add`ed unless explicitly opted-into.
Contributor
Author
|
It's off by default now and enabled with |
rinon
reviewed
Aug 16, 2022
rinon
approved these changes
Aug 16, 2022
cargo add in c2rust-instrument to add c2rust-analysis-rt automaticallycargo add in c2rust-instrument --set-runtime to add c2rust-analysis-rt automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-rtruntime must be added as an (optional) dependency in the instrumented crate. This runscargo add c2rust-analysis-rt --optionalso 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} --offlineis run. Thus, it works well both whenc2rust-analysis-rtis already on your machine and you're developing locally, as well as a user who would downloadc2rust-analysis-rtfrom crates.io. Note thatcargo addis only run when--set-runtimeis passed, so this is off by default, and must be opted-into.Another, more complex, option is to copy the
Cargo.tomlto aCargo.instrument.toml, add thec2rust-analysis-rtdependency there, and the run with--manifest-path Cargo.instrument.toml. However, that's more complex, and not allcargocommands uniformly take a--manifest-pathargument, and there's no environment variable for that, which would be seamlessly inherited.