Skip to content

Commit 3b9cda4

Browse files
RalfJungCentril
andauthored
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <[email protected]>
1 parent f44abba commit 3b9cda4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/libcore/slice/mod.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,12 @@ impl<T> [T] {
293293
/// checking.
294294
///
295295
/// This is generally not recommended, use with caution!
296-
/// Calling this method with an out-of-bounds index is UB even if the resulting
297-
/// reference is not used.
296+
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
297+
/// even if the resulting reference is not used.
298298
/// For a safe alternative see [`get`].
299299
///
300300
/// [`get`]: #method.get
301+
/// [undefined behavior]: ../../reference/behavior-considered-undefined.html
301302
///
302303
/// # Examples
303304
///
@@ -320,11 +321,12 @@ impl<T> [T] {
320321
/// bounds checking.
321322
///
322323
/// This is generally not recommended, use with caution!
323-
/// Calling this method with an out-of-bounds index is UB even if the resulting
324-
/// reference is not used.
324+
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
325+
/// even if the resulting reference is not used.
325326
/// For a safe alternative see [`get_mut`].
326327
///
327328
/// [`get_mut`]: #method.get_mut
329+
/// [undefined behavior]: ../../reference/behavior-considered-undefined.html
328330
///
329331
/// # Examples
330332
///
@@ -2633,15 +2635,17 @@ pub trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
26332635

26342636
/// Returns a shared reference to the output at this location, without
26352637
/// performing any bounds checking.
2636-
/// Calling this method with an out-of-bounds index is UB even if the resulting
2637-
/// reference is not used.
2638+
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
2639+
/// even if the resulting reference is not used.
2640+
/// [undefined behavior]: ../../reference/behavior-considered-undefined.html
26382641
#[unstable(feature = "slice_index_methods", issue = "0")]
26392642
unsafe fn get_unchecked(self, slice: &T) -> &Self::Output;
26402643

26412644
/// Returns a mutable reference to the output at this location, without
26422645
/// performing any bounds checking.
2643-
/// Calling this method with an out-of-bounds index is UB even if the resulting
2644-
/// reference is not used.
2646+
/// Calling this method with an out-of-bounds index is *[undefined behavior]*
2647+
/// even if the resulting reference is not used.
2648+
/// [undefined behavior]: ../../reference/behavior-considered-undefined.html
26452649
#[unstable(feature = "slice_index_methods", issue = "0")]
26462650
unsafe fn get_unchecked_mut(self, slice: &mut T) -> &mut Self::Output;
26472651

0 commit comments

Comments
 (0)