Skip to content

Commit

Permalink
Skip verification of prusti-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
fpoli committed Jun 4, 2021
1 parent 4483103 commit 896e74e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target/
log/
tmp/
viper_tools/
Dockerfile
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ WORKDIR /root
RUN cargo new good-example && \
cd good-example && \
sed -i '1s/^/use prusti_contracts::*;\n/;s/println.*$/assert!(true);/' src/main.rs && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts"}' >> Cargo.toml && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts" }' >> Cargo.toml && \
cargo build && cargo clean && \
cargo prusti && cargo clean
RUN cargo new bad-example && \
cd bad-example && \
sed -i '1s/^/use prusti_contracts::*;\n/;s/println.*$/assert!(false);/' src/main.rs && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts"}' >> Cargo.toml && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts" }' >> Cargo.toml && \
cargo build && cargo clean && \
! cargo prusti && cargo clean
1 change: 0 additions & 1 deletion prusti/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ doctest = false # and no doc tests
[dependencies]
env_logger = "0.8.2"
prusti-contracts = { path = "../prusti-contracts", features = ["prusti"] }
prusti-contracts-internal = { path = "../prusti-contracts-internal" }
prusti-specs = { path = "../prusti-specs" }
prusti-interface = { path = "../prusti-interface" }
prusti-viper = { path = "../prusti-viper" }
Expand Down
14 changes: 11 additions & 3 deletions prusti/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,25 @@ fn init_loggers() {
rustc_driver::init_rustc_env_logger();
}

const PRUSTI_PACKAGES: &'static [&'static str] = &[
"prusti_contracts_internal",
"prusti_contracts_impl",
"prusti_contracts",
"prusti_specs",
];

fn main() {
// We assume that prusti-rustc already removed the first "rustc" argument
// added by RUSTC_WRAPPER and all command line arguments -P<arg>=<val>
// have been filtered out.
let mut rustc_args = config::get_filtered_args();

// If the environment asks us to actually be rustc, or if lints have been disabled, then
// run `rustc` instead of Prusti.
// If the environment asks us to actually be rustc, or if lints have been disabled (which
// indicates that an upstream dependency is being compiled), then run `rustc` instead of Prusti.
let prusti_be_rustc = config::be_rustc();
let are_lints_disabled = arg_value(&rustc_args, "--cap-lints", |val| val == "allow").is_some();
if prusti_be_rustc || are_lints_disabled {
let is_prusti_package = env::var("CARGO_PKG_NAME").map(|name| PRUSTI_PACKAGES.contains(&name.as_str())).unwrap_or(false);
if prusti_be_rustc || are_lints_disabled || is_prusti_package {
rustc_driver::main();
}

Expand Down

0 comments on commit 896e74e

Please sign in to comment.