Skip to content

Commit e5a4477

Browse files
committed
Use CARGO_PRIMARY_PACKAGE to skip dependencies
See also rust-lang/cargo#8758 and rust-lang/rust-clippy#6188
1 parent bb97608 commit e5a4477

File tree

3 files changed

+6
-48
lines changed

3 files changed

+6
-48
lines changed

prusti-tests/tests/compiletest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ fn run_verification_core_proof(group_name: &str, filter: &Option<String>) {
146146
}
147147

148148
fn test_runner(_tests: &[&()]) {
149+
env::set_var("PRUSTI_TESTS", "1");
150+
149151
// Spawn server process as child (so it stays around until main function terminates)
150152
let server_address = ServerSideService::spawn_off_thread();
151153
env::set_var("PRUSTI_SERVER_ADDRESS", server_address.to_string());

prusti/src/arg_value.rs

-45
This file was deleted.

prusti/src/driver.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ extern crate prusti_common;
3030

3131
mod callbacks;
3232
mod verifier;
33-
mod arg_value;
3433

3534
use log::debug;
3635
use std::{env, panic, borrow::Cow, path::PathBuf};
@@ -40,7 +39,6 @@ use lazy_static::lazy_static;
4039
use callbacks::PrustiCompilerCalls;
4140
use rustc_middle::ty::TyCtxt;
4241
use prusti_common::config;
43-
use arg_value::arg_value;
4442

4543
/// Link to report Prusti bugs
4644
const BUG_REPORT_URL: &str = "https://github.com/viperproject/prusti-dev/issues/new";
@@ -125,8 +123,11 @@ fn main() {
125123

126124
// If the environment asks us to actually be rustc, then do that.
127125
// If cargo is compiling a dependency, then be rustc.
126+
let is_prusti_test = env::var("PRUSTI_TESTS").is_ok();
127+
let is_cargo_running = env::var("CARGO_PKG_NAME").is_ok();
128+
let in_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();
128129
let prusti_be_rustc = config::be_rustc()
129-
|| arg_value(&rustc_args, "--cap-lints", |val| val == "allow").is_some();
130+
|| (!is_prusti_test && is_cargo_running && !in_primary_package);
130131
if prusti_be_rustc {
131132
rustc_driver::main();
132133
}

0 commit comments

Comments
 (0)