Browse Source

Add minimal executable to ensure lib is no-std and no-alloc

Test with:

cargo build --target x86_64-unknown-none \
    --manifest-path ci/ensure_no_std/Cargo.toml

Note that currently this test fails, because the lib unconditionally
depends on `alloc`.

After fixing this, the build will be added to run in CI.
JC 2 years ago
parent
commit
194a832ab6
3 changed files with 21 additions and 2 deletions
  1. 2 2
      .gitignore
  2. 9 0
      ci/ensure_no_std/Cargo.toml
  3. 10 0
      ci/ensure_no_std/src/main.rs

+ 2 - 2
.gitignore

@@ -1,2 +1,2 @@
-/target
-Cargo.lock
+**/target
+**/Cargo.lock

+ 9 - 0
ci/ensure_no_std/Cargo.toml

@@ -0,0 +1,9 @@
+[package]
+name = "ensure_no_std"
+version = "0.0.0"
+edition = "2021"
+publish = false
+
+[dependencies]
+printf-compat = { path = "../..", default-features = false }
+

+ 10 - 0
ci/ensure_no_std/src/main.rs

@@ -0,0 +1,10 @@
+#![no_main]
+#![no_std]
+
+use core::panic::PanicInfo;
+use printf_compat as _; // ensure it gets linked
+
+#[panic_handler]
+fn panic(_panic: &PanicInfo<'_>) -> ! {
+    loop {}
+}