@@ -676,8 +676,8 @@ mod _transitions {
676
676
#[ doc( hidden) ]
677
677
#[ must_use]
678
678
#[ inline]
679
- pub const fn forget_aligned ( self ) -> Ptr < ' a , T , I :: WithAlignment < Any > > {
680
- // SAFETY: `Any ` is less restrictive than `Aligned`.
679
+ pub const fn forget_aligned ( self ) -> Ptr < ' a , T , I :: WithAlignment < Unknown > > {
680
+ // SAFETY: `Unknown ` is less restrictive than `Aligned`.
681
681
unsafe { self . assume_invariants ( ) }
682
682
}
683
683
}
@@ -706,15 +706,14 @@ mod _casts {
706
706
/// following properties:
707
707
/// - `u` addresses a subset of the bytes addressed by `p`
708
708
/// - `u` has the same provenance as `p`
709
- /// - If `I::Aliasing` is [`Any`] or [`Shared`], `UnsafeCell`s in `*u`
710
- /// must exist at ranges identical to those at which `UnsafeCell`s
711
- /// exist in `*p`
709
+ /// - If `I::Aliasing` is [`Shared`], `UnsafeCell`s in `*u` must exist
710
+ /// at ranges identical to those at which `UnsafeCell`s exist in `*p`
712
711
#[ doc( hidden) ]
713
712
#[ inline]
714
713
pub unsafe fn cast_unsized_unchecked < U : ' a + ?Sized , F : FnOnce ( * mut T ) -> * mut U > (
715
714
self ,
716
715
cast : F ,
717
- ) -> Ptr < ' a , U , ( I :: Aliasing , Any , Any ) > {
716
+ ) -> Ptr < ' a , U , ( I :: Aliasing , Unknown , Unknown ) > {
718
717
let ptr = cast ( self . as_inner ( ) . as_non_null ( ) . as_ptr ( ) ) ;
719
718
720
719
// SAFETY: Caller promises that `cast` returns a pointer whose
@@ -768,9 +767,11 @@ mod _casts {
768
767
// pointer will permit mutation of this byte during `'a`, by
769
768
// invariant on `self`, no other code assumes that this will
770
769
// not happen.
770
+ // - `Inaccessible`: There are no restrictions we need to uphold.
771
771
// 7. `ptr`, trivially, conforms to the alignment invariant of
772
- // `Any`.
773
- // 8. `ptr`, trivially, conforms to the validity invariant of `Any`.
772
+ // `Unknown`.
773
+ // 8. `ptr`, trivially, conforms to the validity invariant of
774
+ // `Unknown`.
774
775
unsafe { Ptr :: new ( ptr) }
775
776
}
776
777
@@ -784,7 +785,10 @@ mod _casts {
784
785
/// - `u` has the same provenance as `p`
785
786
#[ doc( hidden) ]
786
787
#[ inline]
787
- pub unsafe fn cast_unsized < U , F , R , S > ( self , cast : F ) -> Ptr < ' a , U , ( I :: Aliasing , Any , Any ) >
788
+ pub unsafe fn cast_unsized < U , F , R , S > (
789
+ self ,
790
+ cast : F ,
791
+ ) -> Ptr < ' a , U , ( I :: Aliasing , Unknown , Unknown ) >
788
792
where
789
793
T : Read < I :: Aliasing , R > ,
790
794
U : ' a + ?Sized + Read < I :: Aliasing , S > ,
@@ -927,10 +931,11 @@ mod _casts {
927
931
// 0. Since `U: Read<I::Aliasing, _>`, either:
928
932
// - `I::Aliasing` is `Exclusive`, in which case both `src` and
929
933
// `ptr` conform to `Exclusive`
930
- // - `I::Aliasing` is `Shared` or `Any` and `U` is `Immutable`
931
- // (we already know that `[u8]: Immutable`). In this case,
932
- // neither `U` nor `[u8]` permit mutation, and so `Shared`
933
- // aliasing is satisfied.
934
+ // - `I::Aliasing` is `Shared` or `Inaccessible` and `U` is
935
+ // `Immutable` (we already know that `[u8]: Immutable`). In
936
+ // this case, neither `U` nor `[u8]` permit mutation, and so
937
+ // `Shared` aliasing is satisfied. `Inaccessible` is trivially
938
+ // satisfied since it imposes no requirements.
934
939
// 1. `ptr` conforms to the alignment invariant of `Aligned` because
935
940
// it is derived from `try_cast_into`, which promises that the
936
941
// object described by `target` is validly aligned for `U`.
@@ -1070,7 +1075,7 @@ mod _project {
1070
1075
pub unsafe fn project < U : ' a + ?Sized > (
1071
1076
self ,
1072
1077
projector : impl FnOnce ( * mut T ) -> * mut U ,
1073
- ) -> Ptr < ' a , U , ( I :: Aliasing , Any , Initialized ) > {
1078
+ ) -> Ptr < ' a , U , ( I :: Aliasing , Unknown , Initialized ) > {
1074
1079
// TODO(#1122): If `cast_unsized` were able to reason that, when
1075
1080
// casting from an `Initialized` pointer, the result is another
1076
1081
// `Initialized` pointer, we could remove this method entirely.
0 commit comments