@@ -144,6 +144,7 @@ impl<T: ?Sized> *mut T {
144144 /// }
145145 /// ```
146146 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
147+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
147148 #[ inline]
148149 pub unsafe fn offset ( self , count : isize ) -> * mut T
149150 where
@@ -201,6 +202,7 @@ impl<T: ?Sized> *mut T {
201202 /// assert_eq!(&data, &[0, 2, 0, 4, 0]);
202203 /// ```
203204 #[ stable( feature = "ptr_wrapping_offset" , since = "1.16.0" ) ]
205+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
204206 #[ inline]
205207 pub fn wrapping_offset ( self , count : isize ) -> * mut T
206208 where
@@ -436,6 +438,7 @@ impl<T: ?Sized> *mut T {
436438 /// }
437439 /// ```
438440 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
441+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
439442 #[ inline]
440443 pub unsafe fn add ( self , count : usize ) -> Self
441444 where
@@ -497,6 +500,7 @@ impl<T: ?Sized> *mut T {
497500 /// }
498501 /// ```
499502 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
503+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
500504 #[ inline]
501505 pub unsafe fn sub ( self , count : usize ) -> Self
502506 where
@@ -552,6 +556,7 @@ impl<T: ?Sized> *mut T {
552556 /// }
553557 /// ```
554558 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
559+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
555560 #[ inline]
556561 pub fn wrapping_add ( self , count : usize ) -> Self
557562 where
@@ -607,6 +612,7 @@ impl<T: ?Sized> *mut T {
607612 /// }
608613 /// ```
609614 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
615+ #[ must_use = "returns a new pointer rather than modifying its argument" ]
610616 #[ inline]
611617 pub fn wrapping_sub ( self , count : usize ) -> Self
612618 where
0 commit comments