lowRISC / lowRISC/opentitan

[doc] Rust for C devs: Outdated information and improvements

Open Beginner friendly
#18,954 1 comment 1 reaction 0 assignees View on GitHub
Earlgrey-PROD Triaged Good First Issue
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

### Description

While the [Rust for Embedded C Programmers](https://opentitan.org/book/doc/rust_for_c_devs.html) seems well written and of high quality, there are a few enhancements that could be done:

- [Pointers](https://opentitan.org/book/doc/rust_for_c_devs.html#pointers) section: \
Present [`addr_of`](https://doc.rust-lang.org/stable/core/ptr/macro.addr_of.html) and [`addr_of_mut`](https://doc.rust-lang.org/stable/core/ptr/macro.addr_of_mut.html) as alternatives to `&x as *const T`.

- [Macros](https://opentitan.org/book/doc/rust_for_c_devs.html#macros) section:\
Link to https://veykril.github.io/tlborm/ in addition or instead of https://danielkeep.github.io/tlborm/book/index.html

- [Inline Assembly](https://opentitan.org/book/doc/rust_for_c_devs.html#inline-assembly) section:\
`llvm_asm` has now been removed and [`asm`](https://doc.rust-lang.org/stable/core/arch/macro.asm.html#) is stable since Rust 1.59

Some additional nitpicks:
- The `let else` syntax could also be presented, probably in the [Pattern Matching](https://opentitan.org/book/doc/rust_for_c_devs.html#pattern-matching) section.
- The link in footnote 71 is not clickable.

Contributor guide

Open the contributing guide

Research direction

Open the Rust for Embedded C Programmers page and review the Pointers, Macros, Inline Assembly, Pattern Matching, and footnote 71 sections. Check the linked Rust references and update the outdated or missing information described in the issue, including the links and let-else example; done means all listed improvements are reflected in the rendered document.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.