X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fcore%2Fsrc%2Fslice%2Fmod.rs;h=92b1e1d75c660123021a44bda8d000fa48f6ee2f;hb=32a3edb153f46d2864db0a5e6894a2e2ab8e3d52;hp=aaa00653b99c274cc6fda272fe74402d3143bfaa;hpb=45591408b18e7f93fcf8c09210c9a5a102d84b37;p=rust.git diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index aaa00653b99..92b1e1d75c6 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -553,9 +553,9 @@ pub const fn as_mut_ptr_range(&mut self) -> Range<*mut T> { /// # Examples /// /// ``` - /// let mut v = ["a", "b", "c", "d"]; - /// v.swap(1, 3); - /// assert!(v == ["a", "d", "c", "b"]); + /// let mut v = ["a", "b", "c", "d", "e]; + /// v.swap(2, 4); + /// assert!(v == ["a", "b", "e", "d", "c"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline]