Skip to content

Commit c07573e

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

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ 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 solely an implementation detail that is invisible to zerocopy's
121+
users.
122+
123+
However, Project Safe Transmute will not replace the need for most of
124+
zerocopy's higher-level abstractions over transmutability. The experimental
125+
compiler analysis is a tool for checking the soundness of `unsafe` code—not
126+
a tool to avoid writing `unsafe` code altogether. For the foreseeable
127+
future, crates like zerocopy will still be required in order to provide
128+
higher-level abstractions on top of the building block provided by Project
129+
Safe Transmute.
130+
131+
[Project Safe Transmute]: https://rust-lang.github.io/rfcs/2835-project-safe-transmute.html
132+
[mcp-transmutability]: https://github.com/rust-lang/compiler-team/issues/411
133+
110134
## Disclaimer
111135

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

src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@
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
120+
//! 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
108132
109133
// Sometimes we want to use lints which were added after our MSRV.
110134
// `unknown_lints` is `warn` by default and we deny warnings in CI, so without

0 commit comments

Comments
 (0)