diff --git a/creusot-contracts/Cargo.toml b/creusot-contracts/Cargo.toml index 36bf8bf3b..f7edb1d95 100644 --- a/creusot-contracts/Cargo.toml +++ b/creusot-contracts/Cargo.toml @@ -9,10 +9,12 @@ description = "Provides contracts and logic helpers for Creusot" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] +[target.'cfg(creusot)'.dependencies] +num-rational = "0.3.2" creusot-contracts-proc = { path = "../creusot-contracts-proc", version = "0.3.0" } + +[target.'cfg(not(creusot))'.dependencies] creusot-contracts-dummy = { path = "../creusot-contracts-dummy", version = "0.3.0" } -num-rational = "0.3.2" [features] default = [] diff --git a/creusot-rustc/src/main.rs b/creusot-rustc/src/main.rs index a52b8a471..7ebd448ce 100644 --- a/creusot-rustc/src/main.rs +++ b/creusot-rustc/src/main.rs @@ -18,7 +18,7 @@ use rustc_driver::RunCompiler; use rustc_session::{config::ErrorOutputType, EarlyDiagCtxt}; use std::{env, panic, process::Command}; -const BUG_REPORT_URL: &'static str = &"https://github.com/creusot-rs/creusot/issues/new"; +const BUG_REPORT_URL: &str = "https://github.com/creusot-rs/creusot/issues/new"; struct DefaultCallbacks; impl rustc_driver::Callbacks for DefaultCallbacks {} @@ -75,7 +75,10 @@ fn setup_plugin() { }; RunCompiler::new(&args, &mut ToWhy::new(opts)).run().unwrap(); } - _ => RunCompiler::new(&args, &mut DefaultCallbacks).run().unwrap(), + _ => { + args.push("--cfg=creusot".to_string()); + RunCompiler::new(&args, &mut DefaultCallbacks).run().unwrap() + } } }