diff options
| author | Jendrik <buhtig@jendrik.eu> | 2022-01-13 14:57:57 +0100 |
|---|---|---|
| committer | Jendrik <buhtig@jendrik.eu> | 2022-03-24 15:21:03 +0100 |
| commit | dcdde01aa36f6d441106e2cbb2fafa86edb90149 (patch) | |
| tree | 5b3aa308c0d63cf19080dbe90b33afdfcb8bf26f /library/core/src/slice/raw.rs | |
| parent | 7b0bf9efc939341b48c6e9a335dee8a280085100 (diff) | |
| download | rust-dcdde01aa36f6d441106e2cbb2fafa86edb90149.tar.gz rust-dcdde01aa36f6d441106e2cbb2fafa86edb90149.zip | |
add #[must_use] to functions of slice and its iterators.
Diffstat (limited to 'library/core/src/slice/raw.rs')
| -rw-r--r-- | library/core/src/slice/raw.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/slice/raw.rs b/library/core/src/slice/raw.rs index 39c8d68e4bf..6744400c304 100644 --- a/library/core/src/slice/raw.rs +++ b/library/core/src/slice/raw.rs @@ -85,6 +85,7 @@ use crate::ptr; #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] +#[must_use] pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { debug_check_data_len(data, len); @@ -124,6 +125,7 @@ pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] +#[must_use] pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { debug_check_data_len(data as _, len); @@ -168,6 +170,7 @@ const fn debug_check_data_len<T>(_data: *const T, _len: usize) {} /// Converts a reference to T into a slice of length 1 (without copying). #[stable(feature = "from_ref", since = "1.28.0")] #[rustc_const_unstable(feature = "const_slice_from_ref", issue = "90206")] +#[must_use] pub const fn from_ref<T>(s: &T) -> &[T] { array::from_ref(s) } @@ -175,6 +178,7 @@ pub const fn from_ref<T>(s: &T) -> &[T] { /// Converts a reference to T into a slice of length 1 (without copying). #[stable(feature = "from_ref", since = "1.28.0")] #[rustc_const_unstable(feature = "const_slice_from_ref", issue = "90206")] +#[must_use] pub const fn from_mut<T>(s: &mut T) -> &mut [T] { array::from_mut(s) } |
