Description
When building git-cliff-core with both tokio-runtime and async-std features disabled, the crate fails to compile due to State being undefined.
Currently, git-cliff-core depends on cacache with the following configuration:
cacache = { version = "=13.0.0", features = ["mmap"], default-features = false }
In this configuration, neither tokio-runtime nor async-std is enabled.
However, State and update_state are conditionally defined as follows:
|
#[cfg(any(feature = "async-std", feature = "tokio"))] |
|
enum State { |
|
Idle(Option<Inner>), |
|
Busy(JoinHandle<State>), |
|
} |
|
#[cfg(feature = "tokio")] |
|
/// Update the state. |
|
fn update_state( |
|
current_state: &mut State, |
|
next_state: std::result::Result<State, tokio::task::JoinError>, |
|
) { |
|
match next_state { |
|
Ok(next) => { |
|
*current_state = next; |
|
} |
|
_ => { |
|
*current_state = State::Idle(None); |
|
} |
|
} |
|
} |
|
|
|
#[cfg(not(feature = "tokio"))] |
|
/// Update the state. |
|
fn update_state(current_state: &mut State, next_state: State) { |
|
*current_state = next_state; |
|
} |
When both tokio-runtime and async-std features are disabled:
State is not defined due to the #[cfg(any(...))] gate
update_state is still defined (#[cfg(not(feature = "tokio"))])
- This results in a compilation error because
State is undefined
Expected behavior
git-cliff-core should compile successfully with its current feature settings, even when both tokio-runtime and async-std features are disabled.
Additional context
orhun/git-cliff#1328
Description
When building git-cliff-core with both
tokio-runtimeandasync-stdfeatures disabled, the crate fails to compile due toStatebeing undefined.Currently,
git-cliff-coredepends oncacachewith the following configuration:In this configuration, neither
tokio-runtimenorasync-stdis enabled.However,
Stateandupdate_stateare conditionally defined as follows:cacache-rs/src/content/write.rs
Lines 135 to 139 in 66eae4b
cacache-rs/src/content/write.rs
Lines 412 to 432 in 66eae4b
When both
tokio-runtimeandasync-stdfeatures are disabled:Stateis not defined due to the#[cfg(any(...))]gateupdate_stateis still defined(#[cfg(not(feature = "tokio"))])Stateis undefinedExpected behavior
git-cliff-coreshould compile successfully with its current feature settings, even when bothtokio-runtimeandasync-stdfeatures are disabled.Additional context
orhun/git-cliff#1328