@@ -144,6 +144,7 @@ impl<T: ?Sized> *mut T {
144
144
/// }
145
145
/// ```
146
146
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
147
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
147
148
#[ inline]
148
149
pub unsafe fn offset ( self , count : isize ) -> * mut T
149
150
where
@@ -201,6 +202,7 @@ impl<T: ?Sized> *mut T {
201
202
/// assert_eq!(&data, &[0, 2, 0, 4, 0]);
202
203
/// ```
203
204
#[ stable( feature = "ptr_wrapping_offset" , since = "1.16.0" ) ]
205
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
204
206
#[ inline]
205
207
pub fn wrapping_offset ( self , count : isize ) -> * mut T
206
208
where
@@ -436,6 +438,7 @@ impl<T: ?Sized> *mut T {
436
438
/// }
437
439
/// ```
438
440
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
441
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
439
442
#[ inline]
440
443
pub unsafe fn add ( self , count : usize ) -> Self
441
444
where
@@ -497,6 +500,7 @@ impl<T: ?Sized> *mut T {
497
500
/// }
498
501
/// ```
499
502
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
503
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
500
504
#[ inline]
501
505
pub unsafe fn sub ( self , count : usize ) -> Self
502
506
where
@@ -552,6 +556,7 @@ impl<T: ?Sized> *mut T {
552
556
/// }
553
557
/// ```
554
558
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
559
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
555
560
#[ inline]
556
561
pub fn wrapping_add ( self , count : usize ) -> Self
557
562
where
@@ -607,6 +612,7 @@ impl<T: ?Sized> *mut T {
607
612
/// }
608
613
/// ```
609
614
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
615
+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
610
616
#[ inline]
611
617
pub fn wrapping_sub ( self , count : usize ) -> Self
612
618
where
0 commit comments