oxidecomputer / oxidecomputer/hubris

`pub use counters::Count` in `ringbuf` can't actually be used correctly

Open
#1,951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Description

The Count derive macro attempts to implement the counters::Count trait, so it doesn't work unless the crate in which the macro is expanded has a counters dependency. The ringbuf crate reexports the derive macro, which gives the impression that you can use that without having a direct dependency on counters...but if you do this, your code won't compile. Users still need to add a counters dependency as well, so the re-export doesn't actually do anything useful.

We should probably get rid of it, as it's really just a footgun (but like, a...foot rubber band gun; you can use it to shoot yourself in the foot, but the consequences of shooting yourself in the foot with it are "kind of annoying" but ultimately harmless).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the ringbuf crate's re-export of the Count derive macro and the macro's implementation of the counters::Count trait. Confirm how expansion behaves without a direct counters dependency, then remove the misleading re-export if appropriate and verify that the affected crates still compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
embedded-iot
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.