Skip to content

Commit 563c441

Browse files
committed
fix(asynch): replace runtime panic with compile_error for async-std-rt deprecation
async-std has been discontinued (RUSTSEC-2025-0052). Using panic!() inside a #[cfg(feature = "async-std-rt")] block caused clippy to report an unreachable statement on the subsequent futures-rt block when --all-features was used, because panic!() is a diverging expression. Replace the runtime panic with a module-level compile_error!() so: - Users get a clear compile-time message instead of a runtime panic - No unreachable-code lint is triggered (compile_error! is at module level) - The CI clippy step now uses an explicit feature list excluding async-std-rt (--all-features would always fail since compile_error! fires unconditionally)
1 parent 60fea58 commit 563c441

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

.github/workflows/build_and_lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
run: cargo fmt --all -- --check
3535

3636
- name: Clippy
37-
run: cargo clippy --all-features -- -D warnings
37+
# Exclude async-std-rt: it is deprecated (RUSTSEC-2025-0052) and emits a
38+
# compile_error! at crate level, so --all-features would always fail.
39+
run: cargo clippy --features std,tokio-rt,embassy-rt,actix-rt,futures-rt,smol-rt,core,wallet,models,utils,helpers,json-rpc,websocket,cli -- -D warnings
3840

3941
- name: Build (default)
4042
run: cargo build --release

src/asynch/mod.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ pub mod transaction;
1111
#[cfg(feature = "helpers")]
1212
pub mod wallet;
1313

14+
// async-std has been discontinued (RUSTSEC-2025-0052). Emit a compile-time error so
15+
// callers get a clear message instead of a runtime panic, and avoid unreachable-code
16+
// lint when --all-features is used alongside other runtime feature flags.
17+
#[cfg(feature = "async-std-rt")]
18+
compile_error!(
19+
"The async-std-rt feature is deprecated and no longer supported. \
20+
async-std has been discontinued (RUSTSEC-2025-0052). \
21+
Use the smol-rt feature instead."
22+
);
23+
1424
async fn wait_seconds(_seconds: u64) {
1525
#[cfg(feature = "tokio-rt")]
1626
{
@@ -25,20 +35,6 @@ async fn wait_seconds(_seconds: u64) {
2535
use core::time::Duration;
2636
actix_rt::time::sleep(Duration::from_secs(_seconds)).await;
2737
}
28-
#[cfg(feature = "async-std-rt")]
29-
{
30-
#[deprecated(
31-
since = "1.1.0",
32-
note = "async-std has been discontinued (RUSTSEC-2025-0052). Use the smol-rt feature instead."
33-
)]
34-
fn async_std_sleep_deprecated() {}
35-
#[allow(deprecated)]
36-
async_std_sleep_deprecated();
37-
panic!(
38-
"The async-std-rt feature is deprecated. async-std has been discontinued \
39-
(RUSTSEC-2025-0052). Use the smol-rt feature instead."
40-
);
41-
}
4238
#[cfg(feature = "futures-rt")]
4339
{
4440
use core::time::Duration;

0 commit comments

Comments
 (0)