sptr: The Strict Provenance Polyfill
This library provides a stable polyfill for Rust's Strict Provenance experiment.
Mapping to STD APIs:
// core::ptr (sptr)
;
;
// core::pointer (sptr::Strict)
;
;
;
// NON-STANDARD EXTENSIONS (feature = uptr)
uptr
iptr
// NON-STANDARD EXTENSIONS (feature = opaque_fn)
OpaqueFn
// DEPRECATED BY THIS MODEL in core::pointer (sptr::Strict)
// (disable with `default-features = false`)
;
;
Swapping between the two should be as simple as switching between sptr::
and ptr::
for static functions. For methods, you must import sptr::Strict
into your module for
the extension trait's methods to overlay std. The compiler will (understandably)
complain that you are overlaying std, so you will need to also silence that as
seen in the following example:
use Strict;
let ptr = ;
println!;
By default, this crate will also mark methods on pointers as "deprecated" if they are
incompatible with strict_provenance. If you don't want this, set default-features = false
in your Cargo.toml.
Rust is the canonical source of definitions for these APIs and semantics, but the docs here will vaguely try to mirror the docs checked into Rust.