Skip to content

Commit c798949

Browse files
committed
document zerocopy's relationship to Project Safe Transmute
Fixes #480
1 parent f40c10a commit c798949

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ memory model, and *any future memory model*. We ensure this by:
107107
[Miri]: https://github.com/rust-lang/miri
108108
[Kani]: https://github.com/model-checking/kani
109109

110+
## Relationship to Project Safe Transmute
111+
112+
[Project Safe Transmute] is an official initiative of the Rust Project to
113+
develop language-level support for safer transmutation. The Project consults
114+
with crates like zerocopy to identify aspects of safer transmutation that
115+
would benefit from compiler support, and has developed an [experimental,
116+
compiler-supported analysis][mcp-transmutability] of when a value of one
117+
type is soundly transmutable into another. Once this functionality is
118+
sufficiently mature, zerocopy intends to replace its internal
119+
transmutability analysis with the compiler-supported one. This change will
120+
likely be an implementation detail that is invisible to zerocopy's users.
121+
122+
However, Project Safe Transmute will not replace the need for most of
123+
zerocopy's higher-level abstractions over transmutability. The experimental
124+
compiler analysis is a tool for checking the soundness of `unsafe` code—not
125+
a tool to avoid writing `unsafe` code altogether. For the foreseeable
126+
future, crates like zerocopy will still be required in order to provide
127+
higher-level abstractions on top of the building block provided by Project
128+
Safe Transmute.
129+
130+
[Project Safe Transmute]: https://rust-lang.github.io/rfcs/2835-project-safe-transmute.html
131+
[mcp-transmutability]: https://github.com/rust-lang/compiler-team/issues/411
132+
110133
## Disclaimer
111134

112135
Disclaimer: Zerocopy is not an officially supported Google product.

src/lib.rs

+23
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,29 @@
105105
//!
106106
//! [Miri]: https://github.com/rust-lang/miri
107107
//! [Kani]: https://github.com/model-checking/kani
108+
//!
109+
//! # Relationship to Project Safe Transmute
110+
//!
111+
//! [Project Safe Transmute] is an official initiative of the Rust Project to
112+
//! develop language-level support for safer transmutation. The Project consults
113+
//! with crates like zerocopy to identify aspects of safer transmutation that
114+
//! would benefit from compiler support, and has developed an [experimental,
115+
//! compiler-supported analysis][mcp-transmutability] of when a value of one
116+
//! type is soundly transmutable into another. Once this functionality is
117+
//! sufficiently mature, zerocopy intends to replace its internal
118+
//! transmutability analysis with the compiler-supported one. This change will
119+
//! likely be an implementation detail that is invisible to zerocopy's users.
120+
//!
121+
//! However, Project Safe Transmute will not replace the need for most of
122+
//! zerocopy's higher-level abstractions over transmutability. The experimental
123+
//! compiler analysis is a tool for checking the soundness of `unsafe` code—not
124+
//! a tool to avoid writing `unsafe` code altogether. For the foreseeable
125+
//! future, crates like zerocopy will still be required in order to provide
126+
//! higher-level abstractions on top of the building block provided by Project
127+
//! Safe Transmute.
128+
//!
129+
//! [Project Safe Transmute]: https://rust-lang.github.io/rfcs/2835-project-safe-transmute.html
130+
//! [mcp-transmutability]: https://github.com/rust-lang/compiler-team/issues/411
108131
109132
// Sometimes we want to use lints which were added after our MSRV.
110133
// `unknown_lints` is `warn` by default and we deny warnings in CI, so without

0 commit comments

Comments
 (0)