Skip to content

Commit d4bf056

Browse files
committed
Auto merge of rust-lang#72316 - RalfJung:rollup-70g6bln, r=RalfJung
Rollup of 2 pull requests Successful merges: - rust-lang#72143 (make offset must_use) - rust-lang#72307 (use the new interface to initialize conditional variables) Failed merges: r? @ghost
2 parents 1baf85c + 2cff5d9 commit d4bf056

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1439,9 +1439,9 @@ dependencies = [
14391439

14401440
[[package]]
14411441
name = "hermit-abi"
1442-
version = "0.1.12"
1442+
version = "0.1.13"
14431443
source = "registry+https://github.com/rust-lang/crates.io-index"
1444-
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
1444+
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
14451445
dependencies = [
14461446
"compiler_builtins",
14471447
"libc",

src/libcore/intrinsics.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,7 @@ extern "rust-intrinsic" {
13111311
///
13121312
/// The stabilized version of this intrinsic is
13131313
/// [`std::pointer::offset`](../../std/primitive.pointer.html#method.offset).
1314+
#[must_use = "returns a new pointer rather than modifying its argument"]
13141315
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
13151316

13161317
/// Calculates the offset from a pointer, potentially wrapping.
@@ -1327,6 +1328,7 @@ extern "rust-intrinsic" {
13271328
///
13281329
/// The stabilized version of this intrinsic is
13291330
/// [`std::pointer::wrapping_offset`](../../std/primitive.pointer.html#method.wrapping_offset).
1331+
#[must_use = "returns a new pointer rather than modifying its argument"]
13301332
pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
13311333

13321334
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with

src/libcore/ptr/const_ptr.rs

+6
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl<T: ?Sized> *const T {
150150
/// }
151151
/// ```
152152
#[stable(feature = "rust1", since = "1.0.0")]
153+
#[must_use = "returns a new pointer rather than modifying its argument"]
153154
#[inline]
154155
pub unsafe fn offset(self, count: isize) -> *const T
155156
where
@@ -208,6 +209,7 @@ impl<T: ?Sized> *const T {
208209
/// }
209210
/// ```
210211
#[stable(feature = "ptr_wrapping_offset", since = "1.16.0")]
212+
#[must_use = "returns a new pointer rather than modifying its argument"]
211213
#[inline]
212214
pub fn wrapping_offset(self, count: isize) -> *const T
213215
where
@@ -390,6 +392,7 @@ impl<T: ?Sized> *const T {
390392
/// }
391393
/// ```
392394
#[stable(feature = "pointer_methods", since = "1.26.0")]
395+
#[must_use = "returns a new pointer rather than modifying its argument"]
393396
#[inline]
394397
pub unsafe fn add(self, count: usize) -> Self
395398
where
@@ -451,6 +454,7 @@ impl<T: ?Sized> *const T {
451454
/// }
452455
/// ```
453456
#[stable(feature = "pointer_methods", since = "1.26.0")]
457+
#[must_use = "returns a new pointer rather than modifying its argument"]
454458
#[inline]
455459
pub unsafe fn sub(self, count: usize) -> Self
456460
where
@@ -506,6 +510,7 @@ impl<T: ?Sized> *const T {
506510
/// }
507511
/// ```
508512
#[stable(feature = "pointer_methods", since = "1.26.0")]
513+
#[must_use = "returns a new pointer rather than modifying its argument"]
509514
#[inline]
510515
pub fn wrapping_add(self, count: usize) -> Self
511516
where
@@ -561,6 +566,7 @@ impl<T: ?Sized> *const T {
561566
/// }
562567
/// ```
563568
#[stable(feature = "pointer_methods", since = "1.26.0")]
569+
#[must_use = "returns a new pointer rather than modifying its argument"]
564570
#[inline]
565571
pub fn wrapping_sub(self, count: usize) -> Self
566572
where

src/libcore/ptr/mut_ptr.rs

+6
Original file line numberDiff line numberDiff line change
@@ -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

src/libstd/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dlmalloc = { version = "0.1", features = ['rustc-dep-of-std'] }
4141
fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }
4242

4343
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies]
44-
hermit-abi = { version = "0.1.12", features = ['rustc-dep-of-std'] }
44+
hermit-abi = { version = "0.1.13", features = ['rustc-dep-of-std'] }
4545

4646
[target.wasm32-wasi.dependencies]
4747
wasi = { version = "0.9.0", features = ['rustc-dep-of-std'], default-features = false }

src/libstd/sys/hermit/condvar.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ impl Condvar {
1212
Condvar { identifier: 0 }
1313
}
1414

15-
#[inline]
1615
pub unsafe fn init(&mut self) {
17-
// nothing to do
16+
let _ = abi::init_queue(self.id());
1817
}
1918

2019
pub unsafe fn notify_one(&self) {
@@ -50,7 +49,6 @@ impl Condvar {
5049
ret
5150
}
5251

53-
#[inline]
5452
pub unsafe fn destroy(&self) {
5553
let _ = abi::destroy_queue(self.id());
5654
}

0 commit comments

Comments
 (0)