mirror of https://codeberg.org/topola/topola.git
contracts: use `disable_contracts` feature instead of checking channel
This commit is contained in:
parent
9502c05008
commit
3dd311c5fc
|
|
@ -1,10 +1,14 @@
|
|||
matrix:
|
||||
RUST: [stable, nightly]
|
||||
include:
|
||||
- CHANNEL: stable
|
||||
FEATURES: egui,disable_contracts
|
||||
- CHANNEL: nightly
|
||||
FEATURES: egui
|
||||
|
||||
steps:
|
||||
build_egui:
|
||||
image: rust
|
||||
environment: [CARGO_TERM_COLOR=always]
|
||||
commands:
|
||||
- rustup default $RUST
|
||||
- cargo build --features "egui" --bin "topola-egui"
|
||||
- rustup default "$CHANNEL"
|
||||
- cargo build --features "$FEATURES" --bin "topola-egui"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
matrix:
|
||||
RUST: [stable, nightly]
|
||||
include:
|
||||
- CHANNEL: stable
|
||||
FEATURES: sdl2,disable_contracts
|
||||
- CHANNEL: nightly
|
||||
FEATURES: sdl2
|
||||
|
||||
steps:
|
||||
build_sdl2:
|
||||
|
|
@ -8,5 +12,5 @@ steps:
|
|||
commands:
|
||||
- apt-get update
|
||||
- apt-get -y install cmake
|
||||
- rustup default $RUST
|
||||
- cargo build --features "sdl2" --bin "topola-sdl2-demo"
|
||||
- rustup default "$CHANNEL"
|
||||
- cargo build --features "$FEATURES" --bin "topola-sdl2-demo"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
matrix:
|
||||
RUST: [stable, nightly]
|
||||
include:
|
||||
- CHANNEL: stable
|
||||
FEATURES: disable_contracts
|
||||
- CHANNEL: nightly
|
||||
FEATURES:
|
||||
|
||||
steps:
|
||||
test:
|
||||
image: rust
|
||||
environment: [CARGO_TERM_COLOR=always]
|
||||
commands:
|
||||
- rustup default $RUST
|
||||
- rustup default "$CHANNEL"
|
||||
- cargo check
|
||||
- cargo test
|
||||
- cargo test --features "$FEATURES"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ required-features = ["sdl2"]
|
|||
[features]
|
||||
egui = ["dep:eframe", "dep:egui", "dep:rfd", "dep:futures"]
|
||||
sdl2 = ["dep:sdl2", "dep:gl", "dep:pathfinder_canvas", "dep:pathfinder_geometry", "dep:pathfinder_gl", "dep:pathfinder_renderer", "dep:pathfinder_resources"]
|
||||
disable_contracts = ["contracts/disable_contracts"]
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1.0.56"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(try_blocks)]
|
||||
#![cfg_attr(not(feature = "disable_contracts"), feature(try_blocks))]
|
||||
|
||||
pub mod graph;
|
||||
#[macro_use]
|
||||
|
|
|
|||
|
|
@ -38,4 +38,3 @@ mirai_assertions = []
|
|||
syn = { version = "1.0", features = ["extra-traits", "full", "visit", "visit-mut"] }
|
||||
quote = "1.0"
|
||||
proc-macro2 = "1.0"
|
||||
rustc_version = "0.4"
|
||||
|
|
|
|||
|
|
@ -180,8 +180,6 @@ extern crate proc_macro;
|
|||
|
||||
mod implementation;
|
||||
|
||||
use rustc_version::{version, version_meta, Channel, Version};
|
||||
|
||||
use implementation::ContractMode;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
|
|
@ -199,7 +197,7 @@ use proc_macro::TokenStream;
|
|||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -213,7 +211,7 @@ pub fn requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`requires`]: attr.requires.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn debug_requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +225,7 @@ pub fn debug_requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`requires`]: attr.requires.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn test_requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +264,7 @@ pub fn test_requires(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +278,7 @@ pub fn ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`ensures`]: attr.ensures.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn debug_ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +292,7 @@ pub fn debug_ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`ensures`]: attr.ensures.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn test_ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -346,7 +344,7 @@ pub fn test_ensures(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +365,7 @@ pub fn invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`invariant`]: attr.invariant.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn debug_invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +380,7 @@ pub fn debug_invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// [`invariant`]: attr.invariant.html
|
||||
#[proc_macro_attribute]
|
||||
pub fn test_invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
@ -427,7 +425,7 @@ pub fn test_invariant(attr: TokenStream, toks: TokenStream) -> TokenStream {
|
|||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn contract_trait(attrs: TokenStream, toks: TokenStream) -> TokenStream {
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
if cfg!(feature = "disable_contracts") {
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue