-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Hey folks 👋 using this as the general tracking issue for contributions we'll make to Learn unsafe Rust, out of the Coding Guidelines Subcommittee.
Contribution Model
Edit: I've proposed and had accepted by members of the subcommittee to change-up how we're going to tackle fleshing out guidelines around unsafe
in Rust. My intent here is to attempt to focus our work a bit to have some tangible outputs, improving the state of guidance around unsafe
useful to safety-critical applications and the wider Rust community.
The process I outlined was one in which:
- we pick a handful of chapters from Learn unsafe Rust
- people that are interested raise their hands on whether they are responsible or interested
- These definitions are not written in stone, but you could think of:
- responsible folks generally trying to guide the process, reporting out in subcommittee meetings, taking on coordination work with the project and/or broader Rust ecosystem along with what interested folks will be doing, which is:
- interested folks as contributing to researching on the chapter, writing material, and reviewing material contributed
- the chapter teams run for a while, making PRs into this repo, into the structure they would eventually find themselves in when a PR is opened to the Learn unsafe Rust repo
- when there's general agreement on style and content parity with existing chapters of Learn unsafe Rust we can raise a PR to try to contribute
- I'm sure there's likely to be some suggestions here, so we'll work this until the material is deemed worthy of contribution
- when a chapter team is finished, folks that contributed can disband or pick up another chapter to work or pick up some additional way to contribute to the coding guidelines subcommittee
Chapter goal and style guidelines
In the goals for each chapter are:
- They should talk about a specific topic
- They should tell you how UB around that topic works
- They should tell you when thinking about that topic is relevant (Sometimes it's not obvious! Dealing with padding can end up with validity/uninit issues, for example)
- They should tell you common techniques for safely working with it
- They should tell you what is yet-to-be-decided on the topic, and ideally have some advice on how to work around these specification holes, or assumptions on the specification's future that can be safely made.
Lifted from guidance provided by @Manishearth here.
Mapping from Unsafe Coding Guidelines Reference Glossary to Learn unsafe Rust
A good resource to reference is the Unsafe Coding Guidelines (UCG) Reference Glossary. Below you can find a mapping between the UCG Glossary topics and Learn unsafe Rust
-
- UCG: Soundness (of code / of a library)
- Atomic ordering
- Immutable data
- UCG: Interior mutability?
- Invalid values
- UCG: Niche
- UCG: Representation (relation)
- UCG: Validity and safety invariant
- UCG: Value
- UCG: Zero-sized type / ZST?
- Pinning
- Pointer aliasing
- UCG: Aliasing
- UCG: Memory Address
- UCG: Place
- Uninitialized memory
- UCG: Abstract Byte
- UCG: Allocation
- Variance
-
- Pointer provenance
- UCG: Memory Address
- UCG: Place
- UCG: Pointer Provenance
- Stacked borrows
- Pointer provenance
Initial Chapters for Contribution to Learn unsafe Rust
Some (possibly biased!) ranking of chapters from Learn unsafe Rust I think would be particularly handy for a group working in a safety-critical context:
Learn unsafe Rust Chapter | Rationale | People Responsible | People Interested |
---|---|---|---|
ABI and FFI | Practically speaking we often need to interact with libraries written in C and C++ | @darkwisebear | @pellico, @ChristofPetig, @joej357 |
Intrinsics | One of the first questions asked about, when proposing Rust in automotive. Useful | @vjonaswolf | @vapdrs, @VinEckSie |
Dangling and unaligned pointers | Understanding aliasing can be important, as these concepts differ a bit from their C and C++ definition | @PLeVasseur | @squell, @valexandru, @iglesias |
Sub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
Status