Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #41040

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3fa28cc
Add a note about overflow for fetch_add/fetch_sub
Mar 30, 2017
2946c41
More consistent wording
Mar 30, 2017
d7b3f05
Improve some docs for VecDeque
Mar 31, 2017
44d8b23
Updating the description for BarrierWaitResult #29377
projektir Mar 31, 2017
1e2a61d
Change wording for push_front
Apr 1, 2017
5198072
Added links to from_utf8 methods in Utf8Error
donniebishop Apr 1, 2017
d8fb322
Clean up std::ascii sub-level docs.
Apr 1, 2017
a5d775d
Add more std::ascii module-level docs.
Apr 1, 2017
34cf288
rustc: Stabilize the `#![windows_subsystem]` attribute
alexcrichton Mar 20, 2017
364241c
Added links to types in from_utf8 description
donniebishop Apr 1, 2017
128a313
Improve docs of core::option::IntoIter
irfanhudda Apr 1, 2017
029ace4
Improve docs of core::option::IterMut
irfanhudda Apr 1, 2017
c414628
Improve docs of core::option::Iter
irfanhudda Apr 1, 2017
4c9f8ae
Minor changes to core::option docs
irfanhudda Apr 2, 2017
ff4febf
Improve documentation for `std::fs::DirBuilder`
pgerber Apr 1, 2017
509ef4c
std::thread docs: fix link to current()
SimonSapin Apr 2, 2017
255d919
Fixed typo in doc comments for swap_remove
mandeep Apr 2, 2017
9c1b7ae
Revert "Implement AsRawFd/IntoRawFd for RawFd"
codyps Apr 3, 2017
f74ca38
Refactored swap_remove doc comment upon discussing with BurntSushi an…
mandeep Apr 3, 2017
e7c2160
Fix mutex's docs inconsistency
GuillaumeGomez Mar 17, 2017
930c997
Rollup merge of #40608 - GuillaumeGomez:mutex-doc-inconsistency, r=st…
frewsxcv Apr 3, 2017
9fd0a18
Rollup merge of #40870 - alexcrichton:stabilize-windows-subsystem, r=…
frewsxcv Apr 3, 2017
3682a33
Rollup merge of #40927 - stjepang:docs-atomic-overflow-note, r=alexcr…
frewsxcv Apr 3, 2017
545a89e
Rollup merge of #40949 - stjepang:fix-vecdeque-docs, r=frewsxcv
frewsxcv Apr 3, 2017
f0cbfaa
Rollup merge of #40977 - projektir:BarrierWaitResult_doc, r=steveklabnik
frewsxcv Apr 3, 2017
139e346
Rollup merge of #40988 - eugene-bulkin:ascii-docs, r=frewsxcv
frewsxcv Apr 3, 2017
fd37622
Rollup merge of #40992 - donniebishop:utf8err_linking, r=alexcrichton
frewsxcv Apr 3, 2017
2a01b3e
Rollup merge of #40997 - donniebishop:from_utf8_linking, r=steveklabnik
frewsxcv Apr 3, 2017
ec8f1df
Rollup merge of #40999 - irfanhudda:improve-option-docs, r=steveklabnik
frewsxcv Apr 3, 2017
826ec40
Rollup merge of #41007 - pgerber:dir_builder, r=frewsxcv
frewsxcv Apr 3, 2017
f22cc07
Rollup merge of #41014 - SimonSapin:patch-6, r=frewsxcv
frewsxcv Apr 3, 2017
c303fe0
Rollup merge of #41019 - mandeep:fix-vec-swapremove-docs, r=BurntSushi
frewsxcv Apr 3, 2017
97ce03c
Rollup merge of #41035 - jmesmon:revert-bad-raw-fd-impls, r=aturon
frewsxcv Apr 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,4 @@
- [windows_handle](windows-handle.md)
- [windows_net](windows-net.md)
- [windows_stdio](windows-stdio.md)
- [windows_subsystem](windows-subsystem.md)
- [zero_one](zero-one.md)
10 changes: 0 additions & 10 deletions src/doc/unstable-book/src/windows-subsystem.md

This file was deleted.

5 changes: 3 additions & 2 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ impl<T> Vec<T> {
self.len = len;
}

/// Removes an element from anywhere in the vector and return it, replacing
/// it with the last element.
/// Removes an element from the vector and returns it.
///
/// The removed element is replaced by the last element of the vector.
///
/// This does not preserve ordering, but is O(1).
///
Expand Down
18 changes: 9 additions & 9 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl<T> VecDeque<T> {
}
}

/// Shortens a `VecDeque`, dropping excess elements from the back.
/// Shortens the `VecDeque`, dropping excess elements from the back.
///
/// If `len` is greater than the `VecDeque`'s current length, this has no
/// effect.
Expand Down Expand Up @@ -941,7 +941,7 @@ impl<T> VecDeque<T> {
a.contains(x) || b.contains(x)
}

/// Provides a reference to the front element, or `None` if the sequence is
/// Provides a reference to the front element, or `None` if the `VecDeque` is
/// empty.
///
/// # Examples
Expand All @@ -966,7 +966,7 @@ impl<T> VecDeque<T> {
}

/// Provides a mutable reference to the front element, or `None` if the
/// sequence is empty.
/// `VecDeque` is empty.
///
/// # Examples
///
Expand All @@ -993,7 +993,7 @@ impl<T> VecDeque<T> {
}
}

/// Provides a reference to the back element, or `None` if the sequence is
/// Provides a reference to the back element, or `None` if the `VecDeque` is
/// empty.
///
/// # Examples
Expand All @@ -1018,7 +1018,7 @@ impl<T> VecDeque<T> {
}

/// Provides a mutable reference to the back element, or `None` if the
/// sequence is empty.
/// `VecDeque` is empty.
///
/// # Examples
///
Expand Down Expand Up @@ -1046,7 +1046,7 @@ impl<T> VecDeque<T> {
}
}

/// Removes the first element and returns it, or `None` if the sequence is
/// Removes the first element and returns it, or `None` if the `VecDeque` is
/// empty.
///
/// # Examples
Expand All @@ -1073,7 +1073,7 @@ impl<T> VecDeque<T> {
}
}

/// Inserts an element first in the sequence.
/// Prepends an element to the `VecDeque`.
///
/// # Examples
///
Expand All @@ -1096,7 +1096,7 @@ impl<T> VecDeque<T> {
}
}

/// Appends an element to the back of a buffer
/// Appends an element to the back of the `VecDeque`.
///
/// # Examples
///
Expand All @@ -1117,7 +1117,7 @@ impl<T> VecDeque<T> {
unsafe { self.buffer_write(head, value) }
}

/// Removes the last element from a buffer and returns it, or `None` if
/// Removes the last element from the `VecDeque` and returns it, or `None` if
/// it is empty.
///
/// # Examples
Expand Down
24 changes: 21 additions & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,15 @@ impl<A> ExactSizeIterator for Item<A> {}
impl<A> FusedIterator for Item<A> {}
unsafe impl<A> TrustedLen for Item<A> {}

/// An iterator over a reference of the contained item in an [`Option`].
/// An iterator over a reference to the [`Some`] variant of an [`Option`].
///
/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.
///
/// This `struct` is created by the [`Option::iter`] function.
///
/// [`Option`]: enum.Option.html
/// [`Some`]: enum.Option.html#variant.Some
/// [`Option::iter`]: enum.Option.html#method.iter
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Iter<'a, A: 'a> { inner: Item<&'a A> }
Expand Down Expand Up @@ -933,9 +939,15 @@ impl<'a, A> Clone for Iter<'a, A> {
}
}

/// An iterator over a mutable reference of the contained item in an [`Option`].
/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`].
///
/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.
///
/// This `struct` is created by the [`Option::iter_mut`] function.
///
/// [`Option`]: enum.Option.html
/// [`Some`]: enum.Option.html#variant.Some
/// [`Option::iter_mut`]: enum.Option.html#method.iter_mut
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> }
Expand Down Expand Up @@ -964,9 +976,15 @@ impl<'a, A> FusedIterator for IterMut<'a, A> {}
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {}

/// An iterator over the item contained inside an [`Option`].
/// An iterator over the value in [`Some`] variant of an [`Option`].
///
/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none.
///
/// This `struct` is created by the [`Option::into_iter`] function.
///
/// [`Option`]: enum.Option.html
/// [`Some`]: enum.Option.html#variant.Some
/// [`Option::into_iter`]: enum.Option.html#method.into_iter
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<A> { inner: Item<A> }
Expand Down
34 changes: 23 additions & 11 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,16 @@ impl fmt::Display for ParseBoolError {
Section: Creating a string
*/

/// Errors which can occur when attempting to interpret a sequence of `u8`
/// Errors which can occur when attempting to interpret a sequence of [`u8`]
/// as a string.
///
/// As such, the `from_utf8` family of functions and methods for both `String`s
/// and `&str`s make use of this error, for example.
/// [`u8`]: ../../std/primitive.u8.html
///
/// As such, the `from_utf8` family of functions and methods for both [`String`]s
/// and [`&str`]s make use of this error, for example.
///
/// [`String`]: ../../std/string/struct.String.html#method.from_utf8
/// [`&str`]: ../../std/str/fn.from_utf8.html
#[derive(Copy, Eq, PartialEq, Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Utf8Error {
Expand Down Expand Up @@ -210,11 +215,15 @@ impl Utf8Error {

/// Converts a slice of bytes to a string slice.
///
/// A string slice (`&str`) is made of bytes (`u8`), and a byte slice (`&[u8]`)
/// is made of bytes, so this function converts between the two. Not all byte
/// slices are valid string slices, however: `&str` requires that it is valid
/// UTF-8. `from_utf8()` checks to ensure that the bytes are valid UTF-8, and
/// then does the conversion.
/// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
/// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
/// the two. Not all byte slices are valid string slices, however: [`&str`] requires
/// that it is valid UTF-8. `from_utf8()` checks to ensure that the bytes are valid
/// UTF-8, and then does the conversion.
///
/// [`&str`]: ../../std/primitive.str.html
/// [`u8`]: ../../std/primitive.u8.html
/// [byteslice]: ../../std/primitive.slice.html
///
/// If you are sure that the byte slice is valid UTF-8, and you don't want to
/// incur the overhead of the validity check, there is an unsafe version of
Expand All @@ -228,9 +237,12 @@ impl Utf8Error {
///
/// [string]: ../../std/string/struct.String.html#method.from_utf8
///
/// Because you can stack-allocate a `[u8; N]`, and you can take a `&[u8]` of
/// it, this function is one way to have a stack-allocated string. There is
/// an example of this in the examples section below.
/// Because you can stack-allocate a `[u8; N]`, and you can take a
/// [`&[u8]`][byteslice] of it, this function is one way to have a
/// stack-allocated string. There is an example of this in the
/// examples section below.
///
/// [byteslice]: ../../std/primitive.slice.html
///
/// # Errors
///
Expand Down
39 changes: 29 additions & 10 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl AtomicBool {
}
}

/// Stores a value into the bool, returning the old value.
/// Stores a value into the bool, returning the previous value.
///
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
/// of this operation.
Expand Down Expand Up @@ -732,7 +732,7 @@ impl<T> AtomicPtr<T> {
}
}

/// Stores a value into the pointer, returning the old value.
/// Stores a value into the pointer, returning the previous value.
///
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
/// of this operation.
Expand Down Expand Up @@ -1047,7 +1047,7 @@ macro_rules! atomic_int {
unsafe { atomic_store(self.v.get(), val, order); }
}

/// Stores a value into the atomic integer, returning the old value.
/// Stores a value into the atomic integer, returning the previous value.
///
/// `swap` takes an [`Ordering`] argument which describes the memory ordering of this
/// operation.
Expand Down Expand Up @@ -1201,7 +1201,9 @@ macro_rules! atomic_int {
}
}

/// Add to the current value, returning the previous value.
/// Adds to the current value, returning the previous value.
///
/// This operation wraps around on overflow.
///
/// # Examples
///
Expand All @@ -1218,7 +1220,9 @@ macro_rules! atomic_int {
unsafe { atomic_add(self.v.get(), val, order) }
}

/// Subtract from the current value, returning the previous value.
/// Subtracts from the current value, returning the previous value.
///
/// This operation wraps around on overflow.
///
/// # Examples
///
Expand All @@ -1235,7 +1239,12 @@ macro_rules! atomic_int {
unsafe { atomic_sub(self.v.get(), val, order) }
}

/// Bitwise and with the current value, returning the previous value.
/// Bitwise "and" with the current value.
///
/// Performs a bitwise "and" operation on the current value and the argument `val`, and
/// sets the new value to the result.
///
/// Returns the previous value.
///
/// # Examples
///
Expand All @@ -1251,7 +1260,12 @@ macro_rules! atomic_int {
unsafe { atomic_and(self.v.get(), val, order) }
}

/// Bitwise or with the current value, returning the previous value.
/// Bitwise "or" with the current value.
///
/// Performs a bitwise "or" operation on the current value and the argument `val`, and
/// sets the new value to the result.
///
/// Returns the previous value.
///
/// # Examples
///
Expand All @@ -1267,7 +1281,12 @@ macro_rules! atomic_int {
unsafe { atomic_or(self.v.get(), val, order) }
}

/// Bitwise xor with the current value, returning the previous value.
/// Bitwise "xor" with the current value.
///
/// Performs a bitwise "xor" operation on the current value and the argument `val`, and
/// sets the new value to the result.
///
/// Returns the previous value.
///
/// # Examples
///
Expand Down Expand Up @@ -1415,7 +1434,7 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
}
}

/// Returns the old value (like __sync_fetch_and_add).
/// Returns the previous value (like __sync_fetch_and_add).
#[inline]
unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order {
Expand All @@ -1428,7 +1447,7 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
}
}

/// Returns the old value (like __sync_fetch_and_sub).
/// Returns the previous value (like __sync_fetch_and_sub).
#[inline]
unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
match order {
Expand Down
Loading