diff options
| author | bors <bors@rust-lang.org> | 2020-05-18 07:53:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-18 07:53:03 +0000 |
| commit | d4bf05693c2c16e299f1adc279b54c37a8edef27 (patch) | |
| tree | d0387dbbcea22be75fdf28407eeb24c7a1688a69 /src/libcore | |
| parent | 1baf85c7e09c3b5df645888a456dabefe5866b99 (diff) | |
| parent | 2cff5d961aa67693f0500d59f5d8607efaea9fdd (diff) | |
Auto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung
Rollup of 2 pull requests Successful merges: - #72143 (make offset must_use) - #72307 (use the new interface to initialize conditional variables) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 2 | ||||
| -rw-r--r-- | src/libcore/ptr/const_ptr.rs | 6 | ||||
| -rw-r--r-- | src/libcore/ptr/mut_ptr.rs | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 43512f7a236..a60380137e1 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1311,6 +1311,7 @@ extern "rust-intrinsic" { /// /// The stabilized version of this intrinsic is /// [`std::pointer::offset`](../../std/primitive.pointer.html#method.offset). + #[must_use = "returns a new pointer rather than modifying its argument"] pub fn offset<T>(dst: *const T, offset: isize) -> *const T; /// Calculates the offset from a pointer, potentially wrapping. @@ -1327,6 +1328,7 @@ extern "rust-intrinsic" { /// /// The stabilized version of this intrinsic is /// [`std::pointer::wrapping_offset`](../../std/primitive.pointer.html#method.wrapping_offset). + #[must_use = "returns a new pointer rather than modifying its argument"] pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T; /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with diff --git a/src/libcore/ptr/const_ptr.rs b/src/libcore/ptr/const_ptr.rs index 94ad77d1ec6..85ba5fc0638 100644 --- a/src/libcore/ptr/const_ptr.rs +++ b/src/libcore/ptr/const_ptr.rs @@ -150,6 +150,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn offset(self, count: isize) -> *const T where @@ -208,6 +209,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_offset(self, count: isize) -> *const T where @@ -390,6 +392,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn add(self, count: usize) -> Self where @@ -451,6 +454,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn sub(self, count: usize) -> Self where @@ -506,6 +510,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_add(self, count: usize) -> Self where @@ -561,6 +566,7 @@ impl<T: ?Sized> *const T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_sub(self, count: usize) -> Self where diff --git a/src/libcore/ptr/mut_ptr.rs b/src/libcore/ptr/mut_ptr.rs index cf9e20aa569..0781d7e6cac 100644 --- a/src/libcore/ptr/mut_ptr.rs +++ b/src/libcore/ptr/mut_ptr.rs @@ -144,6 +144,7 @@ impl<T: ?Sized> *mut T { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn offset(self, count: isize) -> *mut T where @@ -201,6 +202,7 @@ impl<T: ?Sized> *mut T { /// assert_eq!(&data, &[0, 2, 0, 4, 0]); /// ``` #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_offset(self, count: isize) -> *mut T where @@ -436,6 +438,7 @@ impl<T: ?Sized> *mut T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn add(self, count: usize) -> Self where @@ -497,6 +500,7 @@ impl<T: ?Sized> *mut T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub unsafe fn sub(self, count: usize) -> Self where @@ -552,6 +556,7 @@ impl<T: ?Sized> *mut T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_add(self, count: usize) -> Self where @@ -607,6 +612,7 @@ impl<T: ?Sized> *mut T { /// } /// ``` #[stable(feature = "pointer_methods", since = "1.26.0")] + #[must_use = "returns a new pointer rather than modifying its argument"] #[inline] pub fn wrapping_sub(self, count: usize) -> Self where |
