@@ -535,6 +535,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
535
535
pub fn copy_into_slice ( & self , dst : & mut [ T ] )
536
536
where
537
537
T : Copy ,
538
+ R : access:: Safe ,
538
539
{
539
540
let len = self . pointer . len ( ) ;
540
541
assert_eq ! (
@@ -591,6 +592,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
591
592
pub fn copy_from_slice ( & mut self , src : & [ T ] )
592
593
where
593
594
T : Copy ,
595
+ W : access:: Safe ,
594
596
{
595
597
let len = self . pointer . len ( ) ;
596
598
assert_eq ! (
@@ -644,6 +646,8 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
644
646
pub fn copy_within ( & mut self , src : impl RangeBounds < usize > , dest : usize )
645
647
where
646
648
T : Copy ,
649
+ R : access:: Safe ,
650
+ W : access:: Safe ,
647
651
{
648
652
let len = self . pointer . len ( ) ;
649
653
// implementation taken from https://github.com/rust-lang/rust/blob/683d1bcd405727fcc9209f64845bd3b9104878b8/library/core/src/slice/mod.rs#L2726-L2738
@@ -819,7 +823,7 @@ impl<'a, T, R, W> VolatilePtr<'a, [T], Access<R, W>> {
819
823
820
824
/// Methods for volatile byte slices
821
825
#[ cfg( feature = "unstable" ) ]
822
- impl < A > VolatilePtr < ' _ , [ u8 ] , A > {
826
+ impl < R , W > VolatilePtr < ' _ , [ u8 ] , Access < R , W > > {
823
827
/// Sets all elements of the byte slice to the given `value` using a volatile `memset`.
824
828
///
825
829
/// This method is similar to the `slice::fill` method of the standard library, with the
@@ -841,7 +845,10 @@ impl<A> VolatilePtr<'_, [u8], A> {
841
845
/// buf.fill(1);
842
846
/// assert_eq!(unsafe { buf.as_ptr().as_mut() }, &mut vec![1; 10]);
843
847
/// ```
844
- pub fn fill ( & mut self , value : u8 ) {
848
+ pub fn fill ( & mut self , value : u8 )
849
+ where
850
+ W : access:: Safe ,
851
+ {
845
852
unsafe {
846
853
intrinsics:: volatile_set_memory ( self . pointer . as_mut_ptr ( ) , value, self . pointer . len ( ) ) ;
847
854
}
0 commit comments