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

Creusot conditional dependencies #1258

Merged
Show file tree
Hide file tree
Changes from all commits
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: 4 additions & 2 deletions creusot-contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 4 additions & 0 deletions creusot-metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ publish = false
[dependencies]
indexmap = "1.7.0"

[package.metadata.rust-analyzer]
# This crate uses #[feature(rustc_private)].
# See https://github.com/rust-analyzer/rust-analyzer/pull/7891
rustc_private = true
6 changes: 5 additions & 1 deletion creusot-rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ creusot = { path = "../creusot", version = "0.3" }
toml = "0.5.8"
env_logger = "0.10"
serde = { version = "1.0", features = ["derive"] }
creusot-args = {path = "../creusot-args"}
creusot-args = { path = "../creusot-args" }

[package.metadata.rust-analyzer]
# This crate uses #[feature(rustc_private)].
# See https://github.com/rust-analyzer/rust-analyzer/pull/7891
rustc_private = true
7 changes: 5 additions & 2 deletions creusot-rustc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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()
}
}
}

Expand Down
Loading