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 8 pull requests #41018

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d7b3f05
Improve some docs for VecDeque
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
810eb03
Rollup merge of #40870 - alexcrichton:stabilize-windows-subsystem, r=…
frewsxcv Apr 3, 2017
f7358ec
Rollup merge of #40949 - stjepang:fix-vecdeque-docs, r=frewsxcv
frewsxcv Apr 3, 2017
a81aaf4
Rollup merge of #40988 - eugene-bulkin:ascii-docs, r=frewsxcv
frewsxcv Apr 3, 2017
b51c991
Rollup merge of #40992 - donniebishop:utf8err_linking, r=alexcrichton
frewsxcv Apr 3, 2017
148afae
Rollup merge of #40997 - donniebishop:from_utf8_linking, r=steveklabnik
frewsxcv Apr 3, 2017
7a86857
Rollup merge of #40999 - irfanhudda:improve-option-docs, r=steveklabnik
frewsxcv Apr 3, 2017
2a75d94
Rollup merge of #41007 - pgerber:dir_builder, r=frewsxcv
frewsxcv Apr 3, 2017
e7bc3d7
Rollup merge of #41014 - SimonSapin:patch-6, r=frewsxcv
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.

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
66 changes: 58 additions & 8 deletions src/libstd/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
// except according to those terms.

//! Operations on ASCII strings and characters.
//!
//! Most string operations in Rust act on UTF-8 strings. However, at times it
//! makes more sense to only consider the ASCII character set for a specific
//! operation.
//!
//! The [`AsciiExt`] trait provides methods that allow for character
//! operations that only act on the ASCII subset and leave non-ASCII characters
//! alone.
//!
//! The [`escape_default`] function provides an iterator over the bytes of an
//! escaped version of the character given.
//!
//! [`AsciiExt`]: trait.AsciiExt.html
//! [`escape_default`]: fn.escape_default.html

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down Expand Up @@ -53,11 +67,11 @@ pub trait AsciiExt {
/// use std::ascii::AsciiExt;
///
/// let ascii = 'a';
/// let utf8 = '❤';
/// let non_ascii = '❤';
/// let int_ascii = 97;
///
/// assert!(ascii.is_ascii());
/// assert!(!utf8.is_ascii());
/// assert!(!non_ascii.is_ascii());
/// assert!(int_ascii.is_ascii());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -79,11 +93,11 @@ pub trait AsciiExt {
/// use std::ascii::AsciiExt;
///
/// let ascii = 'a';
/// let utf8 = '❤';
/// let non_ascii = '❤';
/// let int_ascii = 97;
///
/// assert_eq!('A', ascii.to_ascii_uppercase());
/// assert_eq!('❤', utf8.to_ascii_uppercase());
/// assert_eq!('❤', non_ascii.to_ascii_uppercase());
/// assert_eq!(65, int_ascii.to_ascii_uppercase());
/// ```
///
Expand All @@ -108,11 +122,11 @@ pub trait AsciiExt {
/// use std::ascii::AsciiExt;
///
/// let ascii = 'A';
/// let utf8 = '❤';
/// let non_ascii = '❤';
/// let int_ascii = 65;
///
/// assert_eq!('a', ascii.to_ascii_lowercase());
/// assert_eq!('❤', utf8.to_ascii_lowercase());
/// assert_eq!('❤', non_ascii.to_ascii_lowercase());
/// assert_eq!(97, int_ascii.to_ascii_lowercase());
/// ```
///
Expand Down Expand Up @@ -934,8 +948,12 @@ impl AsciiExt for char {
}
}

/// An iterator over the escaped version of a byte, constructed via
/// `std::ascii::escape_default`.
/// An iterator over the escaped version of a byte.
///
/// This `struct` is created by the [`escape_default`] function. See its
/// documentation for more.
///
/// [`escape_default`]: fn.escape_default.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct EscapeDefault {
range: Range<usize>,
Expand Down Expand Up @@ -966,6 +984,38 @@ pub struct EscapeDefault {
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b't', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'\r');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'r', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'\n');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'n', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'\'');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'\'', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'"');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'"', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'\\');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'\\', escaped.next().unwrap());
///
/// let mut escaped = ascii::escape_default(b'\x9d');
///
/// assert_eq!(b'\\', escaped.next().unwrap());
/// assert_eq!(b'x', escaped.next().unwrap());
/// assert_eq!(b'9', escaped.next().unwrap());
/// assert_eq!(b'd', escaped.next().unwrap());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn escape_default(c: u8) -> EscapeDefault {
Expand Down
9 changes: 6 additions & 3 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1726,9 +1726,9 @@ impl DirBuilder {
}
}

/// Indicate that directories create should be created recursively, creating
/// all parent directories if they do not exist with the same security and
/// permissions settings.
/// Indicates that directories should be created recursively, creating all
/// parent directories. Parents that do not exist are created with the same
/// security and permissions settings.
///
/// This option defaults to `false`.
///
Expand All @@ -1749,6 +1749,9 @@ impl DirBuilder {
/// Create the specified directory with the options configured in this
/// builder.
///
/// It is considered an error if the directory already exists unless
/// recursive mode is enabled.
///
/// # Examples
///
/// ```no_run
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
//! [`Err`]: ../../std/result/enum.Result.html#variant.Err
//! [`panic!`]: ../../std/macro.panic.html
//! [`Builder`]: ../../std/thread/struct.Builder.html
//! [`thread::current`]: ../../std/thread/fn.spawn.html
//! [`thread::current`]: ../../std/thread/fn.current.html
//! [`Thread`]: ../../std/thread/struct.Thread.html
//! [`park`]: ../../std/thread/fn.park.html
//! [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark
Expand Down
12 changes: 3 additions & 9 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ declare_features! (
// Allows attributes on lifetime/type formal parameters in generics (RFC 1327)
(active, generic_param_attrs, "1.11.0", Some(34761)),

// The #![windows_subsystem] attribute
(active, windows_subsystem, "1.14.0", Some(37499)),

// Allows #[link(..., cfg(..))]
(active, link_cfg, "1.14.0", Some(37406)),

Expand Down Expand Up @@ -408,7 +405,8 @@ declare_features! (
(accepted, static_recursion, "1.17.0", Some(29719)),
// pub(restricted) visibilities (RFC 1422)
(accepted, pub_restricted, "1.17.0", Some(32409)),

// The #![windows_subsystem] attribute
(accepted, windows_subsystem, "1.18.0", Some(37499)),
);
// If you change this, please modify src/doc/unstable-book as well. You must
// move that documentation into the relevant place in the other docs, and
Expand Down Expand Up @@ -768,11 +766,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
"unboxed_closures are still evolving",
cfg_fn!(unboxed_closures))),

("windows_subsystem", Whitelisted, Gated(Stability::Unstable,
"windows_subsystem",
"the windows subsystem attribute \
is currently unstable",
cfg_fn!(windows_subsystem))),
("windows_subsystem", Whitelisted, Ungated),

("proc_macro_attribute", Normal, Gated(Stability::Unstable,
"proc_macro",
Expand Down
Loading