340340//! clear where a satisfying unambiguous semantics can be defined for Exposed Provenance.
341341//! Furthermore, Exposed Provenance will not work (well) with tools like [Miri] and [CHERI].
342342//!
343- //! Exposed Provenance is provided by the [`expose_addr`] and [`from_exposed_addr `] methods, which
343+ //! Exposed Provenance is provided by the [`expose_addr`] and [`with_exposed_provenance `] methods, which
344344//! are meant to replace `as` casts between pointers and integers. [`expose_addr`] is a lot like
345345//! [`addr`], but additionally adds the provenance of the pointer to a global list of 'exposed'
346346//! provenances. (This list is purely conceptual, it exists for the purpose of specifying Rust but
347- //! is not materialized in actual executions, except in tools like [Miri].) [`from_exposed_addr `]
347+ //! is not materialized in actual executions, except in tools like [Miri].) [`with_exposed_provenance `]
348348//! can be used to construct a pointer with one of these previously 'exposed' provenances.
349- //! [`from_exposed_addr `] takes only `addr: usize` as arguments, so unlike in [`with_addr`] there is
349+ //! [`with_exposed_provenance `] takes only `addr: usize` as arguments, so unlike in [`with_addr`] there is
350350//! no indication of what the correct provenance for the returned pointer is -- and that is exactly
351351//! what makes pointer-usize-pointer roundtrips so tricky to rigorously specify! There is no
352352//! algorithm that decides which provenance will be used. You can think of this as "guessing" the
355355//! there is *no* previously 'exposed' provenance that justifies the way the returned pointer will
356356//! be used, the program has undefined behavior.
357357//!
358- //! Using [`expose_addr`] or [`from_exposed_addr `] (or the `as` casts) means that code is
358+ //! Using [`expose_addr`] or [`with_exposed_provenance `] (or the `as` casts) means that code is
359359//! *not* following Strict Provenance rules. The goal of the Strict Provenance experiment is to
360360//! determine how far one can get in Rust without the use of [`expose_addr`] and
361- //! [`from_exposed_addr `], and to encourage code to be written with Strict Provenance APIs only.
361+ //! [`with_exposed_provenance `], and to encourage code to be written with Strict Provenance APIs only.
362362//! Maximizing the amount of such code is a major win for avoiding specification complexity and to
363363//! facilitate adoption of tools like [CHERI] and [Miri] that can be a big help in increasing the
364364//! confidence in (unsafe) Rust code.
375375//! [`addr`]: pointer::addr
376376//! [`ptr::dangling`]: core::ptr::dangling
377377//! [`expose_addr`]: pointer::expose_addr
378- //! [`from_exposed_addr `]: from_exposed_addr
378+ //! [`with_exposed_provenance `]: with_exposed_provenance
379379//! [Miri]: https://github.com/rust-lang/miri
380380//! [CHERI]: https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/
381381//! [Strict Provenance]: https://github.com/rust-lang/rust/issues/95228
@@ -581,7 +581,7 @@ pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
581581/// little more than a usize address in disguise.
582582///
583583/// This is different from `addr as *const T`, which creates a pointer that picks up a previously
584- /// exposed provenance. See [`from_exposed_addr `] for more details on that operation.
584+ /// exposed provenance. See [`with_exposed_provenance `] for more details on that operation.
585585///
586586/// This API and its claimed semantics are part of the Strict Provenance experiment,
587587/// see the [module documentation][crate::ptr] for details.
@@ -592,7 +592,7 @@ pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
592592pub const fn without_provenance < T > ( addr : usize ) -> * const T {
593593 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
594594 // We use transmute rather than a cast so tools like Miri can tell that this
595- // is *not* the same as from_exposed_addr .
595+ // is *not* the same as with_exposed_provenance .
596596 // SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
597597 // pointer).
598598 unsafe { mem:: transmute ( addr) }
@@ -625,7 +625,7 @@ pub const fn dangling<T>() -> *const T {
625625/// little more than a usize address in disguise.
626626///
627627/// This is different from `addr as *mut T`, which creates a pointer that picks up a previously
628- /// exposed provenance. See [`from_exposed_addr_mut `] for more details on that operation.
628+ /// exposed provenance. See [`with_exposed_provenance_mut `] for more details on that operation.
629629///
630630/// This API and its claimed semantics are part of the Strict Provenance experiment,
631631/// see the [module documentation][crate::ptr] for details.
@@ -636,7 +636,7 @@ pub const fn dangling<T>() -> *const T {
636636pub const fn without_provenance_mut < T > ( addr : usize ) -> * mut T {
637637 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
638638 // We use transmute rather than a cast so tools like Miri can tell that this
639- // is *not* the same as from_exposed_addr .
639+ // is *not* the same as with_exposed_provenance .
640640 // SAFETY: every valid integer is also a valid pointer (as long as you don't dereference that
641641 // pointer).
642642 unsafe { mem:: transmute ( addr) }
@@ -699,7 +699,7 @@ pub const fn dangling_mut<T>() -> *mut T {
699699#[ unstable( feature = "exposed_provenance" , issue = "95228" ) ]
700700#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
701701#[ allow( fuzzy_provenance_casts) ] // this *is* the explicit provenance API one should use instead
702- pub fn from_exposed_addr < T > ( addr : usize ) -> * const T
702+ pub fn with_exposed_provenance < T > ( addr : usize ) -> * const T
703703where
704704 T : Sized ,
705705{
@@ -739,7 +739,7 @@ where
739739#[ unstable( feature = "exposed_provenance" , issue = "95228" ) ]
740740#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
741741#[ allow( fuzzy_provenance_casts) ] // this *is* the explicit provenance API one should use instead
742- pub fn from_exposed_addr_mut < T > ( addr : usize ) -> * mut T
742+ pub fn with_exposed_provenance_mut < T > ( addr : usize ) -> * mut T
743743where
744744 T : Sized ,
745745{
0 commit comments