From 3149a1d7e856fe06fa24cb64c149ce5128db7d6e Mon Sep 17 00:00:00 2001 From: Jake Lang Date: Sat, 26 Jan 2019 22:30:18 -0500 Subject: [PATCH 1/3] Disable std by default --- Cargo.toml | 2 +- src/lib.rs | 2 ++ src/utils.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fa918f7..f203b68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ wee_alloc = { version = "0.4.4", optional = true } qimalloc = { version = "0.1", optional = true } [features] -default = ["std", "wee_alloc"] +default = ["wee_alloc"] std = [] debug = [] experimental = [] diff --git a/src/lib.rs b/src/lib.rs index 9e7e48c..5a94040 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "std"), no_std)] + //! ewasm_api is a library used to interface with Ethereum's EEI in [Ewasm](https://github.com/ewasm/design), a set of enhancements to //! the Ethereum smart contract platform. //! ewasm_api exposes both a set of unsafe "native" functions representing the actual EEI diff --git a/src/utils.rs b/src/utils.rs index 6b3076c..d640078 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -15,6 +15,7 @@ pub fn unsafe_alloc_buffer(len: usize) -> Vec { mod tests { use super::*; + #[cfg(feature = "std")] #[test] fn smoke() { let ret = unsafe_alloc_buffer(42); From 1a04d2a75ea23ff5e8aeb0958401370ab3572739 Mon Sep 17 00:00:00 2001 From: Jake Lang Date: Sat, 26 Jan 2019 22:34:11 -0500 Subject: [PATCH 2/3] Ensure that non-std fundamentals are available in no-std mode --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 5a94040..aa5ff9d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] +#![feature(lang_items)] //! ewasm_api is a library used to interface with Ethereum's EEI in [Ewasm](https://github.com/ewasm/design), a set of enhancements to //! the Ethereum smart contract platform. From f12b8d50c3b7272bd62df6a20ff59a2bdeb13a16 Mon Sep 17 00:00:00 2001 From: Jake Lang Date: Sat, 26 Jan 2019 23:27:01 -0500 Subject: [PATCH 3/3] Build nightly to fix CI --- circle.yml | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/circle.yml b/circle.yml index 6e8ab55..c644d3f 100644 --- a/circle.yml +++ b/circle.yml @@ -9,7 +9,8 @@ jobs: - run: name: Update rustc command: | - rustup target add wasm32-unknown-unknown + rustup install nightly-x86_64-unknown-linux-gnu + rustup target add wasm32-unknown-unknown --toolchain nightly rustup component add rustfmt rustup update - run: @@ -20,28 +21,28 @@ jobs: - run: name: Test command: | - cargo test --target=x86_64-unknown-linux-gnu - cargo test --release --target=x86_64-unknown-linux-gnu + cargo +nightly test --target=x86_64-unknown-linux-gnu + cargo +nightly test --release --target=x86_64-unknown-linux-gnu - run: name: Build command: | # debug - cargo build + cargo +nightly build # release - cargo build --release + cargo +nightly build --release # different allocators - cargo build --release --features wee_alloc - cargo build --release --features qimalloc + cargo +nightly build --release --features wee_alloc + cargo +nightly build --release --features qimalloc # different allocators (no_std) - cargo build --release --no-default-features --features wee_alloc - cargo build --release --no-default-features --features qimalloc + cargo +nightly build --release --no-default-features --features wee_alloc + cargo +nightly build --release --no-default-features --features qimalloc # different feature sets - cargo build --release --no-default-features - cargo build --release --features debug - cargo build --release --no-default-features --features debug - cargo build --release --features experimental - cargo build --release --no-default-features --features experimental - cargo build --release --features experimental,debug - cargo build --release --no-default-features --features experimental,debug - cargo build --release --features eth2 - cargo build --release --no-default-features --features eth2 + cargo +nightly build --release --no-default-features + cargo +nightly build --release --features debug + cargo +nightly build --release --no-default-features --features debug + cargo +nightly build --release --features experimental + cargo +nightly build --release --no-default-features --features experimental + cargo +nightly build --release --features experimental,debug + cargo +nightly build --release --no-default-features --features experimental,debug + cargo +nightly build --release --features eth2 + cargo +nightly build --release --no-default-features --features eth2