From edb2c2d291811f9b21ed8bd1499648a0614f6fc8 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Tue, 26 Sep 2017 21:16:59 -0400 Subject: Remove uses of mem::transmute in Box methods Makes use of conversions via Unique. --- src/liballoc/boxed.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 4341b0b2975..512c7194fe3 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -269,7 +269,7 @@ impl Box { #[stable(feature = "box_raw", since = "1.4.0")] #[inline] pub unsafe fn from_raw(raw: *mut T) -> Self { - mem::transmute(raw) + Box(Unique::new_unchecked(raw)) } /// Consumes the `Box`, returning the wrapped raw pointer. @@ -295,7 +295,7 @@ impl Box { #[stable(feature = "box_raw", since = "1.4.0")] #[inline] pub fn into_raw(b: Box) -> *mut T { - unsafe { mem::transmute(b) } + Box::into_unique(b).as_ptr() } /// Consumes the `Box`, returning the wrapped pointer as `Unique`. @@ -326,7 +326,9 @@ impl Box { issue = "27730")] #[inline] pub fn into_unique(b: Box) -> Unique { - unsafe { mem::transmute(b) } + let u = b.0; + mem::forget(b); + u } } -- cgit 1.4.1-3-g733a5 From 5e251b74eb200ba6d3b8ddaa68ef682c78be26e2 Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Thu, 5 Oct 2017 16:54:56 -0400 Subject: Modify Rc/Arc language around mutability There are a few exceptions to the rule that Arc/Rc are immutable. Rather than dig into the details, add "generally" to hint at this difference, as it's kind of a distraction at this point in the docs. Additionally, Arc's docs were slightly different here generally, so add in both the existing language and the exception. Fixes #44105 --- src/liballoc/arc.rs | 6 ++++-- src/liballoc/rc.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 3b7dbd813cf..9481cd4e1a4 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -52,8 +52,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// also destroyed. /// /// Shared references in Rust disallow mutation by default, and `Arc` is no -/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex], -/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types. +/// exception: you cannot generally obtain a mutable reference to something +/// inside an `Arc`. If you need to mutate through an `Arc`, use +/// [`Mutex`][mutex], [`RwLock`][rwlock], or one of the [`Atomic`][atomic] +/// types. /// /// ## Thread Safety /// diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 553980d463f..2f8620cc750 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -19,7 +19,7 @@ //! given value is destroyed, the pointed-to value is also destroyed. //! //! Shared references in Rust disallow mutation by default, and [`Rc`] -//! is no exception: you cannot obtain a mutable reference to +//! is no exception: you cannot generally obtain a mutable reference to //! something inside an [`Rc`]. If you need mutability, put a [`Cell`] //! or [`RefCell`] inside the [`Rc`]; see [an example of mutability //! inside an Rc][mutability]. -- cgit 1.4.1-3-g733a5 From 904133e1e28b690e2bbd101b719509aa897539a0 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 6 Oct 2017 16:39:01 -0400 Subject: Revert to using mem::transmute in Box::into_unique Seems to cause this error: "Cannot handle boxed::Box<[u8]> represented as TyLayout". --- src/liballoc/boxed.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 512c7194fe3..6b92da11079 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -326,9 +326,7 @@ impl Box { issue = "27730")] #[inline] pub fn into_unique(b: Box) -> Unique { - let u = b.0; - mem::forget(b); - u + unsafe { mem::transmute(b) } } } -- cgit 1.4.1-3-g733a5 From 452b71a07be066432d93a93c1f9e7f10e18d7c96 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 6 Oct 2017 17:01:50 -0400 Subject: Revert to using mem::transmute in Box::from_raw Same reasons as commit 904133e1e28b690e2bbd101b719509aa897539a0. --- src/liballoc/boxed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6b92da11079..2e77b1b390c 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -269,7 +269,7 @@ impl Box { #[stable(feature = "box_raw", since = "1.4.0")] #[inline] pub unsafe fn from_raw(raw: *mut T) -> Self { - Box(Unique::new_unchecked(raw)) + mem::transmute(raw) } /// Consumes the `Box`, returning the wrapped raw pointer. -- cgit 1.4.1-3-g733a5 From 5ce5b2fe76802385e2974bdec8d82117fb55d0ea Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 6 Oct 2017 17:29:49 -0400 Subject: Create Box::from_unique function Provides a reasonable interface for Box::from_raw implementation. Does not get around the requirement of mem::transmute for converting back and forth between Unique and Box. --- src/liballoc/boxed.rs | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 2e77b1b390c..53d643e7288 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -269,7 +269,34 @@ impl Box { #[stable(feature = "box_raw", since = "1.4.0")] #[inline] pub unsafe fn from_raw(raw: *mut T) -> Self { - mem::transmute(raw) + Box::from_unique(Unique::new_unchecked(raw)) + } + + /// Constructs a `Box` from a `Unique` pointer. + /// + /// After calling this function, the memory is owned by a `Box` and `T` then + /// be destroyed and released upon drop. + /// + /// # Safety + /// + /// A `Unique` can be safely created via [`Unique::new`] and thus doesn't + /// necessarily own the data pointed to nor is the data guaranteed to live + /// as long as the pointer. + /// + /// [`Unique::new`]: ../../core/ptr/struct.Unique.html#method.new + /// + /// # Examples + /// + /// ``` + /// let x = Box::new(5); + /// let ptr = Box::into_unique(x); + /// let x = unsafe { Box::from_unique(ptr) }; + /// ``` + #[unstable(feature = "unique", reason = "needs an RFC to flesh out design", + issue = "27730")] + #[inline] + pub unsafe fn from_unique(u: Unique) -> Self { + mem::transmute(u) } /// Consumes the `Box`, returning the wrapped raw pointer. @@ -303,13 +330,18 @@ impl Box { /// After calling this function, the caller is responsible for the /// memory previously managed by the `Box`. In particular, the /// caller should properly destroy `T` and release the memory. The - /// proper way to do so is to convert the raw pointer back into a - /// `Box` with the [`Box::from_raw`] function. + /// proper way to do so is to either convert the `Unique` pointer: + /// + /// - Into a `Box` with the [`Box::from_unique`] function. + /// + /// - Into a raw pointer and back into a `Box` with the [`Box::from_raw`] + /// function. /// /// Note: this is an associated function, which means that you have /// to call it as `Box::into_unique(b)` instead of `b.into_unique()`. This /// is so that there is no conflict with a method on the inner type. /// + /// [`Box::from_unique`]: struct.Box.html#method.from_unique /// [`Box::from_raw`]: struct.Box.html#method.from_raw /// /// # Examples -- cgit 1.4.1-3-g733a5 From 5af88ee9969320ef900190e1e6a8247d800b7fe6 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 6 Oct 2017 17:39:38 -0400 Subject: Add missing word in Box::from_unique docs --- src/liballoc/boxed.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 53d643e7288..2c14dfb1dd0 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -274,8 +274,8 @@ impl Box { /// Constructs a `Box` from a `Unique` pointer. /// - /// After calling this function, the memory is owned by a `Box` and `T` then - /// be destroyed and released upon drop. + /// After calling this function, the memory is owned by a `Box` and `T` can + /// then be destroyed and released upon drop. /// /// # Safety /// -- cgit 1.4.1-3-g733a5 From 22298b8240d40ed9b3dbdf570bccce56dfbfcd2c Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Fri, 6 Oct 2017 19:21:22 -0400 Subject: Add unique feature in Box::from_unique docs --- src/liballoc/boxed.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 2c14dfb1dd0..0d19b74ebae 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -288,9 +288,13 @@ impl Box { /// # Examples /// /// ``` - /// let x = Box::new(5); - /// let ptr = Box::into_unique(x); - /// let x = unsafe { Box::from_unique(ptr) }; + /// #![feature(unique)] + /// + /// fn main() { + /// let x = Box::new(5); + /// let ptr = Box::into_unique(x); + /// let x = unsafe { Box::from_unique(ptr) }; + /// } /// ``` #[unstable(feature = "unique", reason = "needs an RFC to flesh out design", issue = "27730")] -- cgit 1.4.1-3-g733a5 From a28b2465d366c0169aedf76ed932dc695d0ff049 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 9 Oct 2017 14:45:41 +0200 Subject: usize index message for vec --- src/liballoc/lib.rs | 1 + src/liballoc/vec.rs | 25 ++++++++++++++++++++++++- src/test/compile-fail/index-help.rs | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/index-help.rs (limited to 'src/liballoc') diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index d51aaa23c6a..0cbfc9e9dac 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -121,6 +121,7 @@ #![feature(unique)] #![feature(unsize)] #![feature(allocator_internals)] +#![feature(on_unimplemented)] #![cfg_attr(not(test), feature(fused, fn_traits, placement_new_protocol, swap_with_slice, i128))] #![cfg_attr(test, feature(test, box_heap))] diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 861291194f3..cf34e195dea 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1543,6 +1543,7 @@ impl Hash for Vec { } #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl Index for Vec { type Output = T; @@ -1554,6 +1555,7 @@ impl Index for Vec { } #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl IndexMut for Vec { #[inline] fn index_mut(&mut self, index: usize) -> &mut T { @@ -1562,8 +1564,8 @@ impl IndexMut for Vec { } } - #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index> for Vec { type Output = [T]; @@ -1572,7 +1574,9 @@ impl ops::Index> for Vec { Index::index(&**self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index> for Vec { type Output = [T]; @@ -1581,7 +1585,9 @@ impl ops::Index> for Vec { Index::index(&**self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index> for Vec { type Output = [T]; @@ -1590,7 +1596,9 @@ impl ops::Index> for Vec { Index::index(&**self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index for Vec { type Output = [T]; @@ -1599,7 +1607,9 @@ impl ops::Index for Vec { self } } + #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index> for Vec { type Output = [T]; @@ -1608,7 +1618,9 @@ impl ops::Index> for Vec { Index::index(&**self, index) } } + #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::Index> for Vec { type Output = [T]; @@ -1619,41 +1631,52 @@ impl ops::Index> for Vec { } #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut> for Vec { #[inline] fn index_mut(&mut self, index: ops::Range) -> &mut [T] { IndexMut::index_mut(&mut **self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut> for Vec { #[inline] fn index_mut(&mut self, index: ops::RangeTo) -> &mut [T] { IndexMut::index_mut(&mut **self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut> for Vec { #[inline] fn index_mut(&mut self, index: ops::RangeFrom) -> &mut [T] { IndexMut::index_mut(&mut **self, index) } } + #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut for Vec { #[inline] fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] { self } } + #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut> for Vec { #[inline] fn index_mut(&mut self, index: ops::RangeInclusive) -> &mut [T] { IndexMut::index_mut(&mut **self, index) } } + #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] +#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut> for Vec { #[inline] fn index_mut(&mut self, index: ops::RangeToInclusive) -> &mut [T] { diff --git a/src/test/compile-fail/index-help.rs b/src/test/compile-fail/index-help.rs new file mode 100644 index 00000000000..2d37fc79250 --- /dev/null +++ b/src/test/compile-fail/index-help.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let x = vec![1]; + x[0i32]; //~ ERROR E0277 + //~| NOTE vector indices are of type `usize` or ranges of `usize` +} -- cgit 1.4.1-3-g733a5 From da7aab6e51fd06ea6628324b3be5ab88a4abda4f Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Tue, 17 Oct 2017 20:11:03 -0500 Subject: added examples of closures --- src/liballoc/str.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/liballoc') diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 830128f2b9f..3e273a67000 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -959,13 +959,15 @@ impl str { /// assert_eq!(s.find("Léopard"), Some(13)); /// ``` /// - /// More complex patterns with closures: + /// More complex patterns using point-free style and closures: /// /// ``` /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.find(char::is_whitespace), Some(5)); /// assert_eq!(s.find(char::is_lowercase), Some(1)); + /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5)); + /// assert_eq!(s.find(|c: char| c.is_lowercase()), Some(1)); /// ``` /// /// Not finding the pattern: -- cgit 1.4.1-3-g733a5 From 2a889eb945cdae95fce33fbeb1b79093c456cadd Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Tue, 17 Oct 2017 23:51:27 -0500 Subject: added non trivial examples of closures for str::find --- src/liballoc/str.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 3e273a67000..895607ff8d4 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -966,8 +966,8 @@ impl str { /// /// assert_eq!(s.find(char::is_whitespace), Some(5)); /// assert_eq!(s.find(char::is_lowercase), Some(1)); - /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5)); - /// assert_eq!(s.find(|c: char| c.is_lowercase()), Some(1)); + /// assert_eq!(s.find(|c: char| c.is_whitespace() || c.is_lowercase()), Some(1)); + /// assert_eq!(s.find(|c: char| (c < 'o') && (c > 'a')), Some(4)); /// ``` /// /// Not finding the pattern: -- cgit 1.4.1-3-g733a5 From f8f9005e57852d4775b952d3b430e458a6a414bb Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Fri, 20 Oct 2017 15:29:35 -0400 Subject: Fix most rendering warnings from switching to CommonMark --- src/liballoc/allocator.rs | 6 +++--- src/liballoc/fmt.rs | 1 - src/libcore/hash/sip.rs | 6 +++--- src/libcore/ptr.rs | 12 ++++++------ src/libstd/ascii.rs | 4 +++- src/libstd/ffi/os_str.rs | 3 +-- src/libstd/net/udp.rs | 2 +- src/libstd/process.rs | 2 +- src/libstd/sys/windows/ext/fs.rs | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index 5a9cd82b9d1..3a2022ad429 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -70,7 +70,7 @@ impl Layout { /// /// * `align` must be a power of two, /// - /// * `align` must not exceed 2^31 (i.e. `1 << 31`), + /// * `align` must not exceed 231 (i.e. `1 << 31`), /// /// * `size`, when rounded up to the nearest multiple of `align`, /// must not overflow (i.e. the rounded value must be less than @@ -113,7 +113,7 @@ impl Layout { /// # Safety /// /// This function is unsafe as it does not verify that `align` is - /// a power-of-two that is also less than or equal to 2^31, nor + /// a power-of-two that is also less than or equal to 231, nor /// that `size` aligned to `align` fits within the address space /// (i.e. the `Layout::from_size_align` preconditions). #[inline] @@ -227,7 +227,7 @@ impl Layout { }; // We can assume that `self.align` is a power-of-two that does - // not exceed 2^31. Furthermore, `alloc_size` has already been + // not exceed 231. Furthermore, `alloc_size` has already been // rounded up to a multiple of `self.align`; therefore, the // call to `Layout::from_size_align` below should never panic. Some((Layout::from_size_align(alloc_size, self.align).unwrap(), padded_size)) diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index 578d90c5ba9..58299d5d836 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -475,7 +475,6 @@ //! them with the same character. For example, the `{` character is escaped with //! `{{` and the `}` character is escaped with `}}`. //! -//! [`format!`]: ../../macro.format.html //! [`usize`]: ../../std/primitive.usize.html //! [`isize`]: ../../std/primitive.isize.html //! [`i8`]: ../../std/primitive.i8.html diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index d82de082da6..4e4d9b3f1e2 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -22,7 +22,7 @@ use mem; /// This is currently the default hashing function used by standard library /// (eg. `collections::HashMap` uses it by default). /// -/// See: https://131002.net/siphash/ +/// See: #[unstable(feature = "sip_hash_13", issue = "34767")] #[rustc_deprecated(since = "1.13.0", reason = "use `std::collections::hash_map::DefaultHasher` instead")] @@ -33,7 +33,7 @@ pub struct SipHasher13 { /// An implementation of SipHash 2-4. /// -/// See: https://131002.net/siphash/ +/// See: #[unstable(feature = "sip_hash_13", issue = "34767")] #[rustc_deprecated(since = "1.13.0", reason = "use `std::collections::hash_map::DefaultHasher` instead")] @@ -44,7 +44,7 @@ pub struct SipHasher24 { /// An implementation of SipHash 2-4. /// -/// See: https://131002.net/siphash/ +/// See: /// /// SipHash is a general-purpose hashing function: it runs at a good /// speed (competitive with Spooky and City) and permits strong _keyed_ diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 3d6abbb7e49..01990f61fee 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -551,7 +551,7 @@ impl *const T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory @@ -684,7 +684,7 @@ impl *const T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory @@ -743,7 +743,7 @@ impl *const T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory @@ -1182,7 +1182,7 @@ impl *mut T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory @@ -1382,7 +1382,7 @@ impl *mut T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory @@ -1441,7 +1441,7 @@ impl *mut T { /// /// Most platforms fundamentally can't even construct such an allocation. /// For instance, no known 64-bit platform can ever serve a request - /// for 2^63 bytes due to page-table limitations or splitting the address space. + /// for 263 bytes due to page-table limitations or splitting the address space. /// However, some 32-bit and 16-bit platforms may successfully serve a request for /// more than `isize::MAX` bytes with things like Physical Address /// Extension. As such, memory acquired directly from allocators or memory diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 4e3781ecafa..327deb9b419 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -411,10 +411,12 @@ pub trait AsciiExt { fn is_ascii_hexdigit(&self) -> bool { unimplemented!(); } /// Checks if the value is an ASCII punctuation character: + /// /// U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /` /// U+003A ... U+0040 `: ; < = > ? @` - /// U+005B ... U+0060 `[ \\ ] ^ _ \`` + /// U+005B ... U+0060 ``[ \\ ] ^ _ ` `` /// U+007B ... U+007E `{ | } ~` + /// /// For strings, true if all characters in the string are /// ASCII punctuation. /// diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index a97075ff8d8..8c34660f821 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -41,7 +41,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// # Creating an `OsString` /// /// **From a Rust string**: `OsString` implements -/// [`From`]`<`[`String`]`>`, so you can use `my_string.`[`from`] to +/// [`From`]`<`[`String`]`>`, so you can use `my_string.from` to /// create an `OsString` from a normal Rust string. /// /// **From slices:** Just like you can start with an empty Rust @@ -63,7 +63,6 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// /// [`OsStr`]: struct.OsStr.html /// [`From`]: ../convert/trait.From.html -/// [`from`]: ../convert/trait.From.html#tymethod.from /// [`String`]: ../string/struct.String.html /// [`&str`]: ../primitive.str.html /// [`u8`]: ../primitive.u8.html diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index a8a242846d7..870d11298fe 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -168,7 +168,7 @@ impl UdpSocket { /// This will return an error when the IP version of the local socket /// does not match that returned from [`ToSocketAddrs`]. /// - /// See https://github.com/rust-lang/rust/issues/34202 for more details. + /// See for more details. /// /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html /// diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 533f6590f83..7c107177c64 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -343,7 +343,7 @@ impl Command { /// The search path to be used may be controlled by setting the /// `PATH` environment variable on the Command, /// but this has some implementation limitations on Windows - /// (see https://github.com/rust-lang/rust/issues/37519). + /// (see ). /// /// # Examples /// diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index a532163f61e..24c41046f26 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -32,7 +32,7 @@ pub trait FileExt { /// function, it is set to the end of the read. /// /// Reading beyond the end of the file will always return with a length of - /// 0. + /// 0\. /// /// Note that similar to `File::read`, it is not an error to return with a /// short read. When returning from such a short read, the file pointer is -- cgit 1.4.1-3-g733a5