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 6 pull requests #41017

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
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
16 changes: 0 additions & 16 deletions src/test/compile-fail/windows-subsystem-gated.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/test/compile-fail/windows-subsystem-invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// error-pattern: invalid windows subsystem `wrong`, only `windows` and `console` are allowed

#![feature(windows_subsystem)]
#![windows_subsystem = "wrong"]

fn main() {}
1 change: 0 additions & 1 deletion src/test/run-make/windows-subsystem/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(windows_subsystem)]
#![windows_subsystem = "console"]

fn main() {}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-make/windows-subsystem/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(windows_subsystem)]
#![windows_subsystem = "windows"]

fn main() {}