Open
Description
Many widely used libraries use unsafe code where it's not strictly necessary. Typically this is done for performance reasons, i.e. there are currently no safe abstractions to achieve the goal safely and efficiently. The goal here is to reduce or eliminate the use of unsafe code throughout the ecosystem where it is not strictly necessary without regressing correctness or performance.
The per-crate process for this looks roughly like this:
- Investigate why
unsafe
is used in the first place.git blame
usually helps with that by identifying a commit where a specific line is introduced. - If it's because of performance, rig up a benchmarking harness to evaluate changes if it's not already present. This should take ~15 minutes, see criterion user guide. It conveniently supports comparison against a baseline.
- Try to rewrite unsafe code into safe
- Document your findings - what worked, what didn't, what additional safe abstractions could solve this. This can be used as an example, but you don't have to go into that much detail.
We want to run a lot of crates through this, so we also have some coordination tasks:
- Select high-value crates for analysis based on some criteria, like download count or some such.
- Set up a task tracker so that people can claim certain crates to avoid duplication of effort. A github repo owned by WG would do.
- Write a more clear guide and perhaps some samples so that the effort can be more widely advertised.
Metadata
Metadata
Assignees
Labels
No labels