@@ -544,6 +544,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
544
544
pub fn copy_into_slice ( self , dst : & mut [ T ] )
545
545
where
546
546
T : Copy ,
547
+ R : access:: Safe ,
547
548
{
548
549
let len = self . pointer . len ( ) ;
549
550
assert_eq ! (
@@ -600,6 +601,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
600
601
pub fn copy_from_slice ( self , src : & [ T ] )
601
602
where
602
603
T : Copy ,
604
+ W : access:: Safe ,
603
605
{
604
606
let len = self . pointer . len ( ) ;
605
607
assert_eq ! (
@@ -653,6 +655,8 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
653
655
pub fn copy_within ( self , src : impl RangeBounds < usize > , dest : usize )
654
656
where
655
657
T : Copy ,
658
+ R : access:: Safe ,
659
+ W : access:: Safe ,
656
660
{
657
661
let len = self . pointer . len ( ) ;
658
662
// implementation taken from https://github.com/rust-lang/rust/blob/683d1bcd405727fcc9209f64845bd3b9104878b8/library/core/src/slice/mod.rs#L2726-L2738
@@ -828,7 +832,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
828
832
829
833
/// Methods for volatile byte slices
830
834
#[ cfg( feature = "unstable" ) ]
831
- impl < A > VolatilePtr < ' _ , [ u8 ] , A > {
835
+ impl < R , W > VolatilePtr < ' _ , [ u8 ] , Access < R , W > > {
832
836
/// Sets all elements of the byte slice to the given `value` using a volatile `memset`.
833
837
///
834
838
/// This method is similar to the `slice::fill` method of the standard library, with the
@@ -850,7 +854,10 @@ impl<A> VolatilePtr<'_, [u8], A> {
850
854
/// buf.fill(1);
851
855
/// assert_eq!(unsafe { buf.as_ptr().as_mut() }, &mut vec![1; 10]);
852
856
/// ```
853
- pub fn fill ( self , value : u8 ) {
857
+ pub fn fill ( self , value : u8 )
858
+ where
859
+ W : access:: Safe ,
860
+ {
854
861
unsafe {
855
862
intrinsics:: volatile_set_memory ( self . pointer . as_mut_ptr ( ) , value, self . pointer . len ( ) ) ;
856
863
}
0 commit comments