Skip to content

DOC-7012 Declare futures-util so rust-async cmds_generic compiles - #3896

Merged
andy-stark-redis merged 1 commit into
mainfrom
DOC-7012-rust-async-harness-fix
Aug 28, 2026
Merged

DOC-7012 Declare futures-util so rust-async cmds_generic compiles#3896
andy-stark-redis merged 1 commit into
mainfrom
DOC-7012-rust-async-harness-fix

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

DOC-7012

What

run_rust_async's Cargo.toml deps string in the test harness never declared futures-util, so cargo test failed with unresolved import futures_util on cmds_generic's rust-async example — which needs futures_util::StreamExt in scope to .collect().await an AsyncIter (used by its four scan steps).

Correcting the original diagnosis

DOC-6968 characterized this as "async iteration API drift in the pinned redis-rs." That turned out to be wrong: the example's own use futures_util::StreamExt; import was already correct, and redis-rs's AsyncIter hasn't changed shape. It's a plain missing dependency in the harness's own Cargo.toml template — nothing to do with the pinned redis-rs version.

Verification

  • build/example-test-harness/run.sh cmds_generic rust-asyncPASS (was a compile failure before). Had to delete the cached work/rust-async/Cargo.toml/Cargo.lock first — rust_run only writes Cargo.toml if absent, so a deps-string edit in run.sh doesn't take effect against a stale cache (the same trap as the Java pom.xml caching gotcha).
  • Regression-checked every other rust-async set (cmds_cnxmgmt, cmds_hash, cmds_list, cmds_servermgmt, cmds_set, cmds_sorted_set, cmds_stream, cmds_string, set_and_get, client-specific): all still pass or SKIP as before, except two pre-existing, unrelated failures — confirmed by their actual error text, not assumed:
    • cmds_stream's xadd2 fails because the ambient local Redis (7.2.7) doesn't support IDMP — the same category of gap as DOC-7011's HEXPIRE/FT.CREATE/TS.CREATE.
    • client-specific fails on a missing JsonAsyncCommands/serde_json (RedisJSON support was never wired into this harness at all) — unrelated to futures-util, out of scope here.

🤖 Generated with Claude Code


Note

Low Risk
Test-harness-only dependency template change; no production or library code paths affected.

Overview
Fixes rust-async example compilation in the test harness by correcting the run_rust_async Cargo dependency snippet and declaring futures-util = "0.3" alongside redis (tokio-comp) and tokio.

Examples such as cmds_generic already import futures_util::StreamExt for async scan iteration; the failure was an unresolved import because the harness-generated Cargo.toml never listed that crate—not a redis-rs API change.

Reviewed by Cursor Bugbot for commit bb167fb. Bugbot is set up for automated code reviews on this repo. Configure here.

`run_rust_async`'s Cargo.toml deps string never declared `futures-util`, so
`cargo test` failed with `unresolved import futures_util` wherever an
example calls `.collect().await` on an `AsyncIter` (needs `StreamExt` in
scope). cmds_generic's rust-async example already imports
`futures_util::StreamExt` correctly for its four scan steps — the crate
itself was just never wired into the harness.

This was mischaracterized on DOC-6968 as "async iteration API drift in the
pinned redis-rs." It isn't: the example's own import was already correct,
and redis-rs's `AsyncIter` hasn't changed shape. It's a plain missing
dependency in the harness's own Cargo.toml template.

Regression-checked every other rust-async set. cmds_stream and
client-specific still fail, both for reasons unrelated to this fix: the
ambient local Redis 7.2.7 doesn't support IDMP (cmds_stream's xadd2, same
gap as DOC-7011's HEXPIRE/FT.CREATE/TS.CREATE case), and client-specific
needs the redis crate's `json` feature plus `serde_json`, neither declared
here (RedisJSON support, out of scope for this ticket).

Learned: rust_run only writes work/rust-async/Cargo.toml if it doesn't already exist, so a deps-string edit in run.sh needs the cached Cargo.toml (and Cargo.lock) deleted before the new dependency takes effect — same caching trap as the Java pom.xml one already in memory, just for Cargo instead of Maven
Constraint: Cargo.toml uses the hyphenated crate name `futures-util`; Rust source imports it as `futures_util` (underscore) — Cargo translates automatically, don't "fix" the hyphen to match the import
Gaps: client-specific/rust-async fails on missing JsonAsyncCommands/serde_json (RedisJSON support never wired into this harness) — separate issue, worth its own ticket if RedisJSON rust-async examples are added later
Ticket: DOC-7012
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

DOC-7012

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 5 related items from repository history (5 new this commit):

Memory updated at bb167fb

@andy-stark-redis
andy-stark-redis requested a review from a team August 28, 2026 10:49
@andy-stark-redis andy-stark-redis self-assigned this Aug 28, 2026
@andy-stark-redis andy-stark-redis added the clients Client library docs label Aug 28, 2026

@dwdougherty dwdougherty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@andy-stark-redis
andy-stark-redis merged commit 68708f0 into main Aug 28, 2026
93 checks passed
@andy-stark-redis
andy-stark-redis deleted the DOC-7012-rust-async-harness-fix branch August 28, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants