@@ -221,10 +221,15 @@ pub(crate) struct FatPtr<T> {
221
221
pub ( crate ) len : usize ,
222
222
}
223
223
224
- /// Forms a slice from a pointer and a length.
224
+ /// Forms a raw slice from a pointer and a length.
225
225
///
226
226
/// The `len` argument is the number of **elements**, not the number of bytes.
227
227
///
228
+ /// This function is safe, but actually using the return value is unsafe.
229
+ /// See the documentation of [`from_raw_parts`] for slice safety requirements.
230
+ ///
231
+ /// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
232
+ ///
228
233
/// # Examples
229
234
///
230
235
/// ```rust
@@ -243,12 +248,16 @@ pub fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] {
243
248
unsafe { Repr { raw : FatPtr { data, len } } . rust }
244
249
}
245
250
246
- /// Performs the same functionality as [`from_raw_parts `], except that a
247
- /// mutable slice is returned.
251
+ /// Performs the same functionality as [`slice_from_raw_parts `], except that a
252
+ /// raw mutable slice is returned.
248
253
///
249
- /// See the documentation of [`from_raw_parts `] for more details.
254
+ /// See the documentation of [`slice_from_raw_parts `] for more details.
250
255
///
251
- /// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html
256
+ /// This function is safe, but actually using the return value is unsafe.
257
+ /// See the documentation of [`from_raw_parts_mut`] for slice safety requirements.
258
+ ///
259
+ /// [`slice_from_raw_parts`]: fn.slice_from_raw_parts.html
260
+ /// [`from_raw_parts_mut`]: ../../std/slice/fn.from_raw_parts_mut.html
252
261
#[ inline]
253
262
#[ unstable( feature = "slice_from_raw_parts" , reason = "recently added" , issue = "36925" ) ]
254
263
pub fn slice_from_raw_parts_mut < T > ( data : * mut T , len : usize ) -> * mut [ T ] {
0 commit comments