Skip to content

Commit

Permalink
Auto merge of #45430 - frewsxcv:rollup, r=frewsxcv
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

- Successful merges: #45227, #45356, #45407, #45411, #45418, #45419
- Failed merges: #45421
  • Loading branch information
bors committed Oct 21, 2017
2 parents d532ba7 + 6ed7927 commit 7e70546
Show file tree
Hide file tree
Showing 19 changed files with 260 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A version of this document [can be found online](https://www.rust-lang.org/condu

**Contact**: [[email protected]](mailto:[email protected])

* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
Expand Down
159 changes: 159 additions & 0 deletions src/Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"libstd",
"libtest",
"tools/cargotest",
"tools/clippy",
"tools/compiletest",
"tools/error_index_generator",
"tools/linkchecker",
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 2<sup>31</sup> (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
Expand Down Expand Up @@ -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 2<sup>31</sup>, nor
/// that `size` aligned to `align` fits within the address space
/// (i.e. the `Layout::from_size_align` preconditions).
#[inline]
Expand Down Expand Up @@ -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 2<sup>31</sup>. 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))
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://131002.net/siphash>
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
Expand All @@ -33,7 +33,7 @@ pub struct SipHasher13 {

/// An implementation of SipHash 2-4.
///
/// See: https://131002.net/siphash/
/// See: <https://131002.net/siphash/>
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
Expand All @@ -44,7 +44,7 @@ pub struct SipHasher24 {

/// An implementation of SipHash 2-4.
///
/// See: https://131002.net/siphash/
/// See: <https://131002.net/siphash/>
///
/// SipHash is a general-purpose hashing function: it runs at a good
/// speed (competitive with Spooky and City) and permits strong _keyed_
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down Expand Up @@ -684,7 +684,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down Expand Up @@ -743,7 +743,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down Expand Up @@ -1182,7 +1182,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down Expand Up @@ -1382,7 +1382,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down Expand Up @@ -1441,7 +1441,7 @@ impl<T: ?Sized> *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 2<sup>63</sup> 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
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ carry around references into the HIR, but rather to carry around
*identifier numbers* (or just "ids"). Right now, you will find four
sorts of identifiers in active use:

- `DefId`, which primarily name "definitions" or top-level items.
- `DefId`, which primarily names "definitions" or top-level items.
- You can think of a `DefId` as being shorthand for a very explicit
and complete path, like `std::collections::HashMap`. However,
these paths are able to name things that are not nameable in
Expand Down Expand Up @@ -114,6 +114,6 @@ A **body** represents some kind of executable code, such as the body
of a function/closure or the definition of a constant. Bodies are
associated with an **owner**, which is typically some kind of item
(e.g., a `fn()` or `const`), but could also be a closure expression
(e.g., `|x, y| x + y`). You can use the HIR map to find find the body
(e.g., `|x, y| x + y`). You can use the HIR map to find the body
associated with a given def-id (`maybe_body_owned_by()`) or to find
the owner of a body (`body_owner_def_id()`).
6 changes: 3 additions & 3 deletions src/librustc/mir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ register and define new MIR transformations and analyses.

Most of the code that operates on MIR can be found in the
`librustc_mir` crate or other crates. The code found here in
`librustc` is just the datatype definitions, alonging the functions
`librustc` is just the datatype definitions, along with the functions
which operate on MIR to be placed everywhere else.

## MIR Data Types and visitor
Expand All @@ -27,7 +27,7 @@ As a MIR *consumer*, you are expected to use one of the queries that
returns a "final MIR". As of the time of this writing, there is only
one: `optimized_mir(def_id)`, but more are expected to come in the
future. For foreign def-ids, we simply read the MIR from the other
crate's metadata. But for local query, this query will construct the
crate's metadata. But for local def-ids, the query will construct the
MIR and then iteratively optimize it by putting it through various
pipeline stages. This section describes those pipeline stages and how
you can extend them.
Expand All @@ -51,7 +51,7 @@ a `&'tcx Steal<Mir<'tcx>>`, allocated using
**stolen** by the next suite of optimizations -- this is an
optimization to avoid cloning the MIR. Attempting to use a stolen
result will cause a panic in the compiler. Therefore, it is important
that you not read directly from these intermediate queries except as
that you do not read directly from these intermediate queries except as
part of the MIR processing pipeline.

Because of this stealing mechanism, some care must also be taken to
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/maps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ That is, they take an `&mut Providers` and mutate it in place. Usually
we use the formulation above just because it looks nice, but you could
as well do `providers.type_of = type_of`, which would be equivalent.
(Here, `type_of` would be a top-level function, defined as we saw
before.) So, if we wanted to have add a provider for some other query,
before.) So, if we want to add a provider for some other query,
let's call it `fubar`, into the crate above, we might modify the `provide()`
function like so:

Expand All @@ -185,7 +185,7 @@ pub fn provide(providers: &mut Providers) {
fn fubar<'cx, 'tcx>(tcx: TyCtxt<'cx, 'tcx>, key: DefId) -> Fubar<'tcx> { .. }
```

NB. Most of the `rustc_*` crate only provide **local
NB. Most of the `rustc_*` crates only provide **local
providers**. Almost all **extern providers** wind up going through the
`rustc_metadata` crate, which loads the information from the crate
metadata. But in some cases there are crates that provide queries for
Expand All @@ -201,7 +201,7 @@ Well, defining a query takes place in two steps:
1. first, you have to specify the query name and arguments; and then,
2. you have to supply query providers where needed.

The specify the query name and arguments, you simply add an entry
To specify the query name and arguments, you simply add an entry
to the big macro invocation in `mod.rs`. This will probably have changed
by the time you read this README, but at present it looks something
like:
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3986,6 +3986,10 @@ details.
"##,

E0599: r##"
This error occurs when a method is used on a type which doesn't implement it:
Erroneous code example:
```compile_fail,E0599
struct Mouth;
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
73 changes: 66 additions & 7 deletions src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,18 +498,46 @@ impl TcpStream {

/// Moves this TCP stream into or out of nonblocking mode.
///
/// On Unix this corresponds to calling fcntl, and on Windows this
/// corresponds to calling ioctlsocket.
/// This will result in `read`, `write`, `recv` and `send` operations
/// becoming nonblocking, i.e. immediately returning from their calls.
/// If the IO operation is successful, `Ok` is returned and no further
/// action is required. If the IO operation could not be completed and needs
/// to be retried, an error with kind [`io::ErrorKind::WouldBlock`] is
/// returned.
///
/// On Unix platforms, calling this method corresponds to calling `fcntl`
/// `FIONBIO`. On Windows calling this method corresponds to calling
/// `ioctlsocket` `FIONBIO`.
///
/// # Examples
///
/// Reading bytes from a TCP stream in non-blocking mode:
///
/// ```no_run
/// use std::io::{self, Read};
/// use std::net::TcpStream;
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// let mut stream = TcpStream::connect("127.0.0.1:7878")
/// .expect("Couldn't connect to the server...");
/// stream.set_nonblocking(true).expect("set_nonblocking call failed");
///
/// # fn wait_for_fd() { unimplemented!() }
/// let mut buf = vec![];
/// loop {
/// match stream.read_to_end(&mut buf) {
/// Ok(_) => break,
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
/// // wait until network socket is ready, typically implemented
/// // via platform-specific APIs such as epoll or IOCP
/// wait_for_fd();
/// }
/// Err(e) => panic!("encountered IO error: {}", e),
/// };
/// };
/// println!("bytes: {:?}", buf);
/// ```
///
/// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
#[stable(feature = "net2_mutators", since = "1.9.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.0.set_nonblocking(nonblocking)
Expand Down Expand Up @@ -780,17 +808,48 @@ impl TcpListener {

/// Moves this TCP stream into or out of nonblocking mode.
///
/// On Unix this corresponds to calling fcntl, and on Windows this
/// corresponds to calling ioctlsocket.
/// This will result in the `accept` operation becoming nonblocking,
/// i.e. immediately returning from their calls. If the IO operation is
/// successful, `Ok` is returned and no further action is required. If the
/// IO operation could not be completed and needs to be retried, an error
/// with kind [`io::ErrorKind::WouldBlock`] is returned.
///
/// On Unix platforms, calling this method corresponds to calling `fcntl`
/// `FIONBIO`. On Windows calling this method corresponds to calling
/// `ioctlsocket` `FIONBIO`.
///
/// # Examples
///
/// Bind a TCP listener to an address, listen for connections, and read
/// bytes in nonblocking mode:
///
/// ```no_run
/// use std::io;
/// use std::net::TcpListener;
///
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
/// let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
/// listener.set_nonblocking(true).expect("Cannot set non-blocking");
///
/// # fn wait_for_fd() { unimplemented!() }
/// # fn handle_connection(stream: std::net::TcpStream) { unimplemented!() }
/// for stream in listener.incoming() {
/// match stream {
/// Ok(s) => {
/// // do something with the TcpStream
/// handle_connection(s);
/// }
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
/// // wait until network socket is ready, typically implemented
/// // via platform-specific APIs such as epoll or IOCP
/// wait_for_fd();
/// continue;
/// }
/// Err(e) => panic!("encountered IO error: {}", e),
/// }
/// }
/// ```
///
/// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
#[stable(feature = "net2_mutators", since = "1.9.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.0.set_nonblocking(nonblocking)
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/rust-lang/rust/issues/34202> for more details.
///
/// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/rust-lang/rust/issues/37519>).
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/windows/ext/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy
2 changes: 1 addition & 1 deletion src/tools/toolstate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
miri = "Broken"

# ping @Manishearth @llogiq @mcarton @oli-obk
clippy = "Broken"
clippy = "Compiling"

# ping @nrc
rls = "Testing"
Expand Down

0 comments on commit 7e70546

Please sign in to comment.