Skip to content
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

Adds functionality to ignore dependencies contracts #1496

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions prusti-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ lazy_static::lazy_static! {
settings.set_default::<Option<u8>>("number_of_parallel_verifiers", None).unwrap();
settings.set_default::<Option<String>>("min_prusti_version", None).unwrap();
settings.set_default("num_errors_per_function", 1).unwrap();
settings.set_default("ignore_deps_contracts", false).unwrap();

settings.set_default("print_desugared_specs", false).unwrap();
settings.set_default("print_typeckd_specs", false).unwrap();
Expand Down Expand Up @@ -1030,3 +1031,8 @@ pub fn enable_type_invariants() -> bool {
pub fn num_errors_per_function() -> u32 {
read_setting("num_errors_per_function")
}

/// When enabled Prusti won't collect contracts from the project's dependencies
pub fn ignore_deps_contracts() -> bool {
read_setting("ignore_deps_contracts")
}
8 changes: 5 additions & 3 deletions prusti/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,18 @@ fn main() {
val == "build_script_build"
})
.is_some();
if config::be_rustc() || build_script_build {

// This environment variable will not be set when building dependencies.
let is_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();

if config::be_rustc() || build_script_build || (!is_primary_package && config::ignore_deps_contracts()) {
fpoli marked this conversation as resolved.
Show resolved Hide resolved
driver::main();
}

// Initialize Prusti and the Rust compiler loggers.
// This must be done after the build script check, otherwise Tokio's global tracing will fail.
let _log_flush_guard = init_loggers();

// This environment variable will not be set when building dependencies.
let is_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();
// Is this crate a dependency when user doesn't want to verify dependencies
let is_no_verify_dep_crate = !is_primary_package && config::no_verify_deps();

Expand Down
Loading