From 079441de2fd46b119ea9e2c781cf2411d7d2f3b5 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:12:46 +1300 Subject: [PATCH 1/2] fix: Ensure `nightly` feature doesn't force `unwinding` --- Cargo.toml | 2 +- src/lib.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7d2b845..e3963ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ default = ["std", "log", "libc", "errno", "signal", "init-fini-arrays", "program # If you're using nightly Rust, enable this feature to let origin use # nightly-only features, which include proper support for unwinding (if # enabled), better safety checks, and better optimizations. -nightly = ["unwinding"] +nightly = ["dep:unwinding"] # Enable optimizations that reduce code size (at the cost of performance). optimize_for_size = [] diff --git a/src/lib.rs b/src/lib.rs index 5621b38..a86f3ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,8 +37,12 @@ pub(crate) mod naked; #[cfg(all(feature = "unwinding", not(target_arch = "arm")))] #[allow(unused_extern_crates)] extern crate unwinding; -#[cfg(all(feature = "unwinding", target_arch = "arm"))] +#[cfg(any(not(feature = "unwinding"), target_arch = "arm"))] mod unwind_unimplemented; +// If we don't have "unwinding", provide stub functions for unwinding and +// panicking. +#[cfg(not(feature = "unwinding"))] +mod stubs; #[cfg_attr(target_arch = "aarch64", path = "arch/aarch64.rs")] #[cfg_attr(target_arch = "x86_64", path = "arch/x86_64.rs")] @@ -66,11 +70,6 @@ pub mod signal; #[cfg_attr(not(feature = "take-charge"), path = "thread/libc.rs")] pub mod thread; -// If we don't have "unwinding", provide stub functions for unwinding and -// panicking. -#[cfg(not(feature = "unwinding"))] -mod stubs; - // Include definitions of `memcpy` and other functions called from LLVM // Codegen. Normally, these would be defined by the platform libc, however with // origin with `take-charge`, there is no libc. Otherwise normally, these From e0db774d966d5a7593aa24e9253d01ef5c86ea59 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:56:06 +1300 Subject: [PATCH 2/2] chore: `nightly` feature should still enable `unwinding` as a feature --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e3963ef..7d2b845 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ default = ["std", "log", "libc", "errno", "signal", "init-fini-arrays", "program # If you're using nightly Rust, enable this feature to let origin use # nightly-only features, which include proper support for unwinding (if # enabled), better safety checks, and better optimizations. -nightly = ["dep:unwinding"] +nightly = ["unwinding"] # Enable optimizations that reduce code size (at the cost of performance). optimize_for_size = []