Finite state machines in rust; bendns fork to add types.
ensure the library can be compiled in a no_std env
Yevhenii Babichenko 2020-08-26
parent ee49cb0 · commit b9cddba
-rw-r--r--.github/workflows/tests.yml6
-rw-r--r--Cargo.toml5
-rw-r--r--ensure_no_std/Cargo.toml8
-rw-r--r--ensure_no_std/src/main.rs18
4 files changed, 36 insertions, 1 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 76cb6e2..48f6fb0 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -29,6 +29,12 @@ jobs:
with:
command: clippy
+ - name: Ensure the library compiles in a no_std env
+ uses: actions-rs/cargo@v1
+ with:
+ command: rustc
+ args: --manifest-path ensure_no_std/Cargo.toml -- -C link-arg=-nostartfiles
+
- name: Run tests
uses: actions-rs/cargo@v1
env:
diff --git a/Cargo.toml b/Cargo.toml
index 37a6d75..87c4dcc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,5 +15,8 @@ edition = "2018"
[dependencies]
rust-fsm-dsl = { path = "./rust_fsm_dsl", version = "0.3.0" }
+[profile.dev]
+panic = "abort"
+
[workspace]
-members = [".", "rust_fsm_dsl"]
+members = [".", "rust_fsm_dsl", "ensure_no_std"]
diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml
new file mode 100644
index 0000000..6db14fb
--- /dev/null
+++ b/ensure_no_std/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "ensure_no_std"
+version = "0.1.0"
+authors = ["Yevhenii Babichenko <[email protected]>"]
+edition = "2018"
+
+[dependencies]
+rust-fsm = { path = ".." }
diff --git a/ensure_no_std/src/main.rs b/ensure_no_std/src/main.rs
new file mode 100644
index 0000000..6307aa2
--- /dev/null
+++ b/ensure_no_std/src/main.rs
@@ -0,0 +1,18 @@
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[allow(unused_imports)]
+use rust_fsm;
+
+/// This function is called on panic.
+#[panic_handler]
+fn panic(_info: &PanicInfo) -> ! {
+ loop {}
+}
+
+#[no_mangle]
+pub extern "C" fn _start() -> ! {
+ loop {}
+}