Skip to content

Commit

Permalink
cargo-creusot: Set by default --target-dir=target/creusot (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysxia authored Dec 4, 2024
2 parents 8746e60 + dc63961 commit 5737d8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cargo-creusot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ fn invoke_cargo(args: &CreusotArgs, cargo_flags: Vec<String>) {
// (the `mir_borrowck` hook in `creusot/src/callbacks.rs` is not called on all closures).
cmd.env("CARGO_INCREMENTAL", "0");

// Prevent `cargo creusot` and `cargo` from invalidating each other's caches.
if env::var_os("CARGO_TARGET_DIR").is_none() {
cmd.env("CARGO_TARGET_DIR", "target/creusot");
}

// Append flags to any pre-existing ones
// CARGO_ENCODED_RUSTFLAGS contains options to pass to rustc, separated by '\x1f'.
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
Expand Down
2 changes: 0 additions & 2 deletions creusot/tests/creusot-contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ fn main() {
"--span-mode=relative",
"--spans-relative-to=creusot/tests/creusot-contracts",
"--",
"--target-dir",
"target/creusot",
"--package",
"creusot-contracts",
]);
Expand Down
4 changes: 1 addition & 3 deletions creusot/tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ fn main() {
temp_file.as_os_str(),
"--output-file=/dev/null".as_ref(),
]);
metadata_file
.args(&["--", "--target-dir", "target/creusot", "--package", "creusot-contracts"])
.env("CREUSOT_CONTINUE", "true");
metadata_file.args(&["--", "--package", "creusot-contracts"]).env("CREUSOT_CONTINUE", "true");

if !metadata_file.status().expect("could not dump metadata for `creusot_contracts`").success() {
// eprintln!("{}", String::from_utf8_lossy(&metadata_file.output().unwrap().stderr));
Expand Down

0 comments on commit 5737d8f

Please sign in to comment.