Skip to content

Commit 7e70546

Browse files
committed
Auto merge of #45430 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests - Successful merges: #45227, #45356, #45407, #45411, #45418, #45419 - Failed merges: #45421
2 parents d532ba7 + 6ed7927 commit 7e70546

File tree

19 files changed

+260
-37
lines changed

19 files changed

+260
-37
lines changed

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
66

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

9-
* 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.
9+
* 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.
1010
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
1111
* Please be kind and courteous. There's no need to be mean or rude.
1212
* 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.

src/Cargo.lock

+159
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ members = [
55
"libstd",
66
"libtest",
77
"tools/cargotest",
8+
"tools/clippy",
89
"tools/compiletest",
910
"tools/error_index_generator",
1011
"tools/linkchecker",

src/liballoc/allocator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Layout {
7070
///
7171
/// * `align` must be a power of two,
7272
///
73-
/// * `align` must not exceed 2^31 (i.e. `1 << 31`),
73+
/// * `align` must not exceed 2<sup>31</sup> (i.e. `1 << 31`),
7474
///
7575
/// * `size`, when rounded up to the nearest multiple of `align`,
7676
/// must not overflow (i.e. the rounded value must be less than
@@ -113,7 +113,7 @@ impl Layout {
113113
/// # Safety
114114
///
115115
/// This function is unsafe as it does not verify that `align` is
116-
/// a power-of-two that is also less than or equal to 2^31, nor
116+
/// a power-of-two that is also less than or equal to 2<sup>31</sup>, nor
117117
/// that `size` aligned to `align` fits within the address space
118118
/// (i.e. the `Layout::from_size_align` preconditions).
119119
#[inline]
@@ -227,7 +227,7 @@ impl Layout {
227227
};
228228

229229
// We can assume that `self.align` is a power-of-two that does
230-
// not exceed 2^31. Furthermore, `alloc_size` has already been
230+
// not exceed 2<sup>31</sup>. Furthermore, `alloc_size` has already been
231231
// rounded up to a multiple of `self.align`; therefore, the
232232
// call to `Layout::from_size_align` below should never panic.
233233
Some((Layout::from_size_align(alloc_size, self.align).unwrap(), padded_size))

src/liballoc/fmt.rs

-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@
475475
//! them with the same character. For example, the `{` character is escaped with
476476
//! `{{` and the `}` character is escaped with `}}`.
477477
//!
478-
//! [`format!`]: ../../macro.format.html
479478
//! [`usize`]: ../../std/primitive.usize.html
480479
//! [`isize`]: ../../std/primitive.isize.html
481480
//! [`i8`]: ../../std/primitive.i8.html

src/libcore/hash/sip.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use mem;
2222
/// This is currently the default hashing function used by standard library
2323
/// (eg. `collections::HashMap` uses it by default).
2424
///
25-
/// See: https://131002.net/siphash/
25+
/// See: <https://131002.net/siphash>
2626
#[unstable(feature = "sip_hash_13", issue = "34767")]
2727
#[rustc_deprecated(since = "1.13.0",
2828
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
@@ -33,7 +33,7 @@ pub struct SipHasher13 {
3333

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

4545
/// An implementation of SipHash 2-4.
4646
///
47-
/// See: https://131002.net/siphash/
47+
/// See: <https://131002.net/siphash/>
4848
///
4949
/// SipHash is a general-purpose hashing function: it runs at a good
5050
/// speed (competitive with Spooky and City) and permits strong _keyed_

src/libcore/ptr.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl<T: ?Sized> *const T {
551551
///
552552
/// Most platforms fundamentally can't even construct such an allocation.
553553
/// For instance, no known 64-bit platform can ever serve a request
554-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
554+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
555555
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
556556
/// more than `isize::MAX` bytes with things like Physical Address
557557
/// Extension. As such, memory acquired directly from allocators or memory
@@ -684,7 +684,7 @@ impl<T: ?Sized> *const T {
684684
///
685685
/// Most platforms fundamentally can't even construct such an allocation.
686686
/// For instance, no known 64-bit platform can ever serve a request
687-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
687+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
688688
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
689689
/// more than `isize::MAX` bytes with things like Physical Address
690690
/// Extension. As such, memory acquired directly from allocators or memory
@@ -743,7 +743,7 @@ impl<T: ?Sized> *const T {
743743
///
744744
/// Most platforms fundamentally can't even construct such an allocation.
745745
/// For instance, no known 64-bit platform can ever serve a request
746-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
746+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
747747
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
748748
/// more than `isize::MAX` bytes with things like Physical Address
749749
/// Extension. As such, memory acquired directly from allocators or memory
@@ -1182,7 +1182,7 @@ impl<T: ?Sized> *mut T {
11821182
///
11831183
/// Most platforms fundamentally can't even construct such an allocation.
11841184
/// For instance, no known 64-bit platform can ever serve a request
1185-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
1185+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
11861186
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
11871187
/// more than `isize::MAX` bytes with things like Physical Address
11881188
/// Extension. As such, memory acquired directly from allocators or memory
@@ -1382,7 +1382,7 @@ impl<T: ?Sized> *mut T {
13821382
///
13831383
/// Most platforms fundamentally can't even construct such an allocation.
13841384
/// For instance, no known 64-bit platform can ever serve a request
1385-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
1385+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
13861386
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
13871387
/// more than `isize::MAX` bytes with things like Physical Address
13881388
/// Extension. As such, memory acquired directly from allocators or memory
@@ -1441,7 +1441,7 @@ impl<T: ?Sized> *mut T {
14411441
///
14421442
/// Most platforms fundamentally can't even construct such an allocation.
14431443
/// For instance, no known 64-bit platform can ever serve a request
1444-
/// for 2^63 bytes due to page-table limitations or splitting the address space.
1444+
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
14451445
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
14461446
/// more than `isize::MAX` bytes with things like Physical Address
14471447
/// Extension. As such, memory acquired directly from allocators or memory

src/librustc/hir/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ carry around references into the HIR, but rather to carry around
5757
*identifier numbers* (or just "ids"). Right now, you will find four
5858
sorts of identifiers in active use:
5959

60-
- `DefId`, which primarily name "definitions" or top-level items.
60+
- `DefId`, which primarily names "definitions" or top-level items.
6161
- You can think of a `DefId` as being shorthand for a very explicit
6262
and complete path, like `std::collections::HashMap`. However,
6363
these paths are able to name things that are not nameable in
@@ -114,6 +114,6 @@ A **body** represents some kind of executable code, such as the body
114114
of a function/closure or the definition of a constant. Bodies are
115115
associated with an **owner**, which is typically some kind of item
116116
(e.g., a `fn()` or `const`), but could also be a closure expression
117-
(e.g., `|x, y| x + y`). You can use the HIR map to find find the body
117+
(e.g., `|x, y| x + y`). You can use the HIR map to find the body
118118
associated with a given def-id (`maybe_body_owned_by()`) or to find
119119
the owner of a body (`body_owner_def_id()`).

src/librustc/mir/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ register and define new MIR transformations and analyses.
66

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

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

5757
Because of this stealing mechanism, some care must also be taken to

src/librustc/ty/maps/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ That is, they take an `&mut Providers` and mutate it in place. Usually
169169
we use the formulation above just because it looks nice, but you could
170170
as well do `providers.type_of = type_of`, which would be equivalent.
171171
(Here, `type_of` would be a top-level function, defined as we saw
172-
before.) So, if we wanted to have add a provider for some other query,
172+
before.) So, if we want to add a provider for some other query,
173173
let's call it `fubar`, into the crate above, we might modify the `provide()`
174174
function like so:
175175

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

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

204-
The specify the query name and arguments, you simply add an entry
204+
To specify the query name and arguments, you simply add an entry
205205
to the big macro invocation in `mod.rs`. This will probably have changed
206206
by the time you read this README, but at present it looks something
207207
like:

src/librustc_typeck/diagnostics.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3986,6 +3986,10 @@ details.
39863986
"##,
39873987

39883988
E0599: r##"
3989+
This error occurs when a method is used on a type which doesn't implement it:
3990+
3991+
Erroneous code example:
3992+
39893993
```compile_fail,E0599
39903994
struct Mouth;
39913995

src/libstd/ascii.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,12 @@ pub trait AsciiExt {
411411
fn is_ascii_hexdigit(&self) -> bool { unimplemented!(); }
412412

413413
/// Checks if the value is an ASCII punctuation character:
414+
///
414415
/// U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`
415416
/// U+003A ... U+0040 `: ; < = > ? @`
416-
/// U+005B ... U+0060 `[ \\ ] ^ _ \``
417+
/// U+005B ... U+0060 ``[ \\ ] ^ _ ` ``
417418
/// U+007B ... U+007E `{ | } ~`
419+
///
418420
/// For strings, true if all characters in the string are
419421
/// ASCII punctuation.
420422
///

src/libstd/ffi/os_str.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
4141
/// # Creating an `OsString`
4242
///
4343
/// **From a Rust string**: `OsString` implements
44-
/// [`From`]`<`[`String`]`>`, so you can use `my_string.`[`from`] to
44+
/// [`From`]`<`[`String`]`>`, so you can use `my_string.from` to
4545
/// create an `OsString` from a normal Rust string.
4646
///
4747
/// **From slices:** Just like you can start with an empty Rust
@@ -63,7 +63,6 @@ use sys_common::{AsInner, IntoInner, FromInner};
6363
///
6464
/// [`OsStr`]: struct.OsStr.html
6565
/// [`From`]: ../convert/trait.From.html
66-
/// [`from`]: ../convert/trait.From.html#tymethod.from
6766
/// [`String`]: ../string/struct.String.html
6867
/// [`&str`]: ../primitive.str.html
6968
/// [`u8`]: ../primitive.u8.html

src/libstd/net/tcp.rs

+66-7
Original file line numberDiff line numberDiff line change
@@ -498,18 +498,46 @@ impl TcpStream {
498498

499499
/// Moves this TCP stream into or out of nonblocking mode.
500500
///
501-
/// On Unix this corresponds to calling fcntl, and on Windows this
502-
/// corresponds to calling ioctlsocket.
501+
/// This will result in `read`, `write`, `recv` and `send` operations
502+
/// becoming nonblocking, i.e. immediately returning from their calls.
503+
/// If the IO operation is successful, `Ok` is returned and no further
504+
/// action is required. If the IO operation could not be completed and needs
505+
/// to be retried, an error with kind [`io::ErrorKind::WouldBlock`] is
506+
/// returned.
507+
///
508+
/// On Unix platforms, calling this method corresponds to calling `fcntl`
509+
/// `FIONBIO`. On Windows calling this method corresponds to calling
510+
/// `ioctlsocket` `FIONBIO`.
503511
///
504512
/// # Examples
505513
///
514+
/// Reading bytes from a TCP stream in non-blocking mode:
515+
///
506516
/// ```no_run
517+
/// use std::io::{self, Read};
507518
/// use std::net::TcpStream;
508519
///
509-
/// let stream = TcpStream::connect("127.0.0.1:8080")
510-
/// .expect("Couldn't connect to the server...");
520+
/// let mut stream = TcpStream::connect("127.0.0.1:7878")
521+
/// .expect("Couldn't connect to the server...");
511522
/// stream.set_nonblocking(true).expect("set_nonblocking call failed");
523+
///
524+
/// # fn wait_for_fd() { unimplemented!() }
525+
/// let mut buf = vec![];
526+
/// loop {
527+
/// match stream.read_to_end(&mut buf) {
528+
/// Ok(_) => break,
529+
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
530+
/// // wait until network socket is ready, typically implemented
531+
/// // via platform-specific APIs such as epoll or IOCP
532+
/// wait_for_fd();
533+
/// }
534+
/// Err(e) => panic!("encountered IO error: {}", e),
535+
/// };
536+
/// };
537+
/// println!("bytes: {:?}", buf);
512538
/// ```
539+
///
540+
/// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
513541
#[stable(feature = "net2_mutators", since = "1.9.0")]
514542
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
515543
self.0.set_nonblocking(nonblocking)
@@ -780,17 +808,48 @@ impl TcpListener {
780808

781809
/// Moves this TCP stream into or out of nonblocking mode.
782810
///
783-
/// On Unix this corresponds to calling fcntl, and on Windows this
784-
/// corresponds to calling ioctlsocket.
811+
/// This will result in the `accept` operation becoming nonblocking,
812+
/// i.e. immediately returning from their calls. If the IO operation is
813+
/// successful, `Ok` is returned and no further action is required. If the
814+
/// IO operation could not be completed and needs to be retried, an error
815+
/// with kind [`io::ErrorKind::WouldBlock`] is returned.
816+
///
817+
/// On Unix platforms, calling this method corresponds to calling `fcntl`
818+
/// `FIONBIO`. On Windows calling this method corresponds to calling
819+
/// `ioctlsocket` `FIONBIO`.
785820
///
786821
/// # Examples
787822
///
823+
/// Bind a TCP listener to an address, listen for connections, and read
824+
/// bytes in nonblocking mode:
825+
///
788826
/// ```no_run
827+
/// use std::io;
789828
/// use std::net::TcpListener;
790829
///
791-
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
830+
/// let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
792831
/// listener.set_nonblocking(true).expect("Cannot set non-blocking");
832+
///
833+
/// # fn wait_for_fd() { unimplemented!() }
834+
/// # fn handle_connection(stream: std::net::TcpStream) { unimplemented!() }
835+
/// for stream in listener.incoming() {
836+
/// match stream {
837+
/// Ok(s) => {
838+
/// // do something with the TcpStream
839+
/// handle_connection(s);
840+
/// }
841+
/// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
842+
/// // wait until network socket is ready, typically implemented
843+
/// // via platform-specific APIs such as epoll or IOCP
844+
/// wait_for_fd();
845+
/// continue;
846+
/// }
847+
/// Err(e) => panic!("encountered IO error: {}", e),
848+
/// }
849+
/// }
793850
/// ```
851+
///
852+
/// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
794853
#[stable(feature = "net2_mutators", since = "1.9.0")]
795854
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
796855
self.0.set_nonblocking(nonblocking)

src/libstd/net/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl UdpSocket {
168168
/// This will return an error when the IP version of the local socket
169169
/// does not match that returned from [`ToSocketAddrs`].
170170
///
171-
/// See https://github.com/rust-lang/rust/issues/34202 for more details.
171+
/// See <https://github.com/rust-lang/rust/issues/34202> for more details.
172172
///
173173
/// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html
174174
///

src/libstd/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl Command {
343343
/// The search path to be used may be controlled by setting the
344344
/// `PATH` environment variable on the Command,
345345
/// but this has some implementation limitations on Windows
346-
/// (see https://github.com/rust-lang/rust/issues/37519).
346+
/// (see <https://github.com/rust-lang/rust/issues/37519>).
347347
///
348348
/// # Examples
349349
///

src/libstd/sys/windows/ext/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub trait FileExt {
3232
/// function, it is set to the end of the read.
3333
///
3434
/// Reading beyond the end of the file will always return with a length of
35-
/// 0.
35+
/// 0\.
3636
///
3737
/// Note that similar to `File::read`, it is not an error to return with a
3838
/// short read. When returning from such a short read, the file pointer is

src/tools/clippy

src/tools/toolstate.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
miri = "Broken"
2727

2828
# ping @Manishearth @llogiq @mcarton @oli-obk
29-
clippy = "Broken"
29+
clippy = "Compiling"
3030

3131
# ping @nrc
3232
rls = "Testing"

0 commit comments

Comments
 (0)