Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Make Peripherals::steal() zero cost

Open
#356 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start in src/peripheral/mod.rs around line 180 and inspect how Peripherals::steal() constructs and returns the zero-sized Peripherals value. Confirm the implementation no longer performs the static mut write and remains safe under its existing contract; the completed change should make the function zero-cost.

Written by the indexing model from the issue text.

Description

Peripherals::steal() has a write to a static mut: https://github.com/rust-embedded/cortex-m/blob/6b013138b734b9bbeb24a345f75d2bcc1c69fa8d/src/peripheral/mod.rs#L180

I expected it to be zero-cost, just constructing and returning the Peripherals which is a noop since it is ZST. This was a bit surprising.

Dominant language
Rust
Stars
1k
Forks
201
Avg merge
1h 8m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from rust-embedded/cortex-m

All issues in rust-embedded/cortex-m

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.