Skip to content

Commit 50932b5

Browse files
authored
Auto merge of #36864 - steveklabnik:rollup, r=steveklabnik
Rollup of 13 pull requests - Successful merges: #36529, #36535, #36576, #36623, #36711, #36750, #36810, #36829, #36833, #36841, #36842, #36851, #36860 - Failed merges:
2 parents 9548730 + af1df98 commit 50932b5

File tree

15 files changed

+116
-79
lines changed

15 files changed

+116
-79
lines changed

RELEASES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Diagnostics
5454
Most common editors supporting Rust have been updated to work with it. It was
5555
previously described [on the Rust blog]
5656
(https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-come.html).
57-
* [In error descriptions, references are now described in plain english,
57+
* [In error descriptions, references are now described in plain English,
5858
instead of as "&-ptr"]
5959
(https://github.com/rust-lang/rust/pull/35611)
6060
* [In error type descriptions, unknown numeric types are named `{integer}` or
@@ -148,7 +148,7 @@ Libraries
148148
(https://github.com/rust-lang/rust/pull/34946)
149149
* [`hash_map::Entry`, `hash_map::VacantEntry` and `hash_map::OccupiedEntry`
150150
implement `Debug`]
151-
(https://github.com/rust-lang/rust/pull/34946)
151+
(https://github.com/rust-lang/rust/pull/34937)
152152
* [`btree_map::Entry`, `btree_map::VacantEntry` and `btree_map::OccupiedEntry`
153153
implement `Debug`]
154154
(https://github.com/rust-lang/rust/pull/34885)
@@ -885,7 +885,7 @@ Cargo
885885
Performance
886886
-----------
887887

888-
* [The time complexity of comparing variables for equivalence during type
888+
* [The time complexity of comparing variables for equivalence during type
889889
unification is reduced from _O_(_n_!) to _O_(_n_)][1.9tu]. This leads
890890
to major compilation time improvement in some scenarios.
891891
* [`ToString` is specialized for `str`, giving it the same performance

src/doc/book/references-and-borrowing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn main() {
8686
return v.iter().fold(0, |a, &b| a + b);
8787
}
8888
// Borrow two vectors and sum them.
89-
// This kind of borrowing does not allow mutation to the borrowed.
89+
// This kind of borrowing does not allow mutation through the borrowed reference.
9090
fn foo(v1: &Vec<i32>, v2: &Vec<i32>) -> i32 {
9191
// do stuff with v1 and v2
9292
let s1 = sum_vec(v1);

src/doc/reference.md

+10
Original file line numberDiff line numberDiff line change
@@ -3959,6 +3959,16 @@ the top-level type for the implementation of the called method. If no such metho
39593959
found, `.deref()` is called and the compiler continues to search for the method
39603960
implementation in the returned type `U`.
39613961

3962+
## The `Send` trait
3963+
3964+
The `Send` trait indicates that a value of this type is safe to send from one
3965+
thread to another.
3966+
3967+
## The 'Sync' trait
3968+
3969+
The 'Sync' trait indicates that a value of this type is safe to share between
3970+
multiple threads.
3971+
39623972
# Memory model
39633973

39643974
A Rust program's memory consists of a static set of *items* and a *heap*.

src/liballoc/boxed.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,14 @@ impl<T: ?Sized> Box<T> {
244244
/// the destructor of `T` and free the allocated memory. Since the
245245
/// way `Box` allocates and releases memory is unspecified, the
246246
/// only valid pointer to pass to this function is the one taken
247-
/// from another `Box` via the `Box::into_raw` function.
247+
/// from another `Box` via the [`Box::into_raw`] function.
248248
///
249249
/// This function is unsafe because improper use may lead to
250250
/// memory problems. For example, a double-free may occur if the
251251
/// function is called twice on the same raw pointer.
252252
///
253+
/// [`Box::into_raw`]: struct.Box.html#method.into_raw
254+
///
253255
/// # Examples
254256
///
255257
/// ```
@@ -269,12 +271,14 @@ impl<T: ?Sized> Box<T> {
269271
/// memory previously managed by the `Box`. In particular, the
270272
/// caller should properly destroy `T` and release the memory. The
271273
/// proper way to do so is to convert the raw pointer back into a
272-
/// `Box` with the `Box::from_raw` function.
274+
/// `Box` with the [`Box::from_raw`] function.
273275
///
274276
/// Note: this is an associated function, which means that you have
275277
/// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
276278
/// is so that there is no conflict with a method on the inner type.
277279
///
280+
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
281+
///
278282
/// # Examples
279283
///
280284
/// ```

src/libcollections/slice.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<T> [T] {
168168
core_slice::SliceExt::len(self)
169169
}
170170

171-
/// Returns true if the slice has a length of 0
171+
/// Returns true if the slice has a length of 0.
172172
///
173173
/// # Example
174174
///
@@ -402,7 +402,7 @@ impl<T> [T] {
402402
core_slice::SliceExt::get_unchecked_mut(self, index)
403403
}
404404

405-
/// Returns an raw pointer to the slice's buffer
405+
/// Returns an raw pointer to the slice's buffer.
406406
///
407407
/// The caller must ensure that the slice outlives the pointer this
408408
/// function returns, or else it will end up pointing to garbage.
@@ -468,7 +468,7 @@ impl<T> [T] {
468468
///
469469
/// # Examples
470470
///
471-
/// ```rust
471+
/// ```
472472
/// let mut v = ["a", "b", "c", "d"];
473473
/// v.swap(1, 3);
474474
/// assert!(v == ["a", "d", "c", "b"]);
@@ -483,7 +483,7 @@ impl<T> [T] {
483483
///
484484
/// # Example
485485
///
486-
/// ```rust
486+
/// ```
487487
/// let mut v = [1, 2, 3];
488488
/// v.reverse();
489489
/// assert!(v == [3, 2, 1]);
@@ -567,9 +567,9 @@ impl<T> [T] {
567567
}
568568

569569
/// Returns an iterator over `size` elements of the slice at a
570-
/// time. The chunks are slices and do not overlap. If `size` does not divide the
571-
/// length of the slice, then the last chunk will not have length
572-
/// `size`.
570+
/// time. The chunks are slices and do not overlap. If `size` does
571+
/// not divide the length of the slice, then the last chunk will
572+
/// not have length `size`.
573573
///
574574
/// # Panics
575575
///
@@ -656,7 +656,7 @@ impl<T> [T] {
656656
///
657657
/// # Examples
658658
///
659-
/// ```rust
659+
/// ```
660660
/// let mut v = [1, 2, 3, 4, 5, 6];
661661
///
662662
/// // scoped to restrict the lifetime of the borrows
@@ -754,7 +754,7 @@ impl<T> [T] {
754754
}
755755

756756
/// Returns an iterator over subslices separated by elements that match
757-
/// `pred`, limited to returning at most `n` items. The matched element is
757+
/// `pred`, limited to returning at most `n` items. The matched element is
758758
/// not contained in the subslices.
759759
///
760760
/// The last element returned, if any, will contain the remainder of the
@@ -781,7 +781,7 @@ impl<T> [T] {
781781
}
782782

783783
/// Returns an iterator over subslices separated by elements that match
784-
/// `pred`, limited to returning at most `n` items. The matched element is
784+
/// `pred`, limited to returning at most `n` items. The matched element is
785785
/// not contained in the subslices.
786786
///
787787
/// The last element returned, if any, will contain the remainder of the
@@ -835,7 +835,7 @@ impl<T> [T] {
835835

836836
/// Returns an iterator over subslices separated by elements that match
837837
/// `pred` limited to returning at most `n` items. This starts at the end of
838-
/// the slice and works backwards. The matched element is not contained in
838+
/// the slice and works backwards. The matched element is not contained in
839839
/// the subslices.
840840
///
841841
/// The last element returned, if any, will contain the remainder of the
@@ -922,9 +922,9 @@ impl<T> [T] {
922922
///
923923
/// Looks up a series of four elements. The first is found, with a
924924
/// uniquely determined position; the second and third are not
925-
/// found; the fourth could match any position in `[1,4]`.
925+
/// found; the fourth could match any position in `[1, 4]`.
926926
///
927-
/// ```rust
927+
/// ```
928928
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
929929
///
930930
/// assert_eq!(s.binary_search(&13), Ok(9));
@@ -956,9 +956,9 @@ impl<T> [T] {
956956
///
957957
/// Looks up a series of four elements. The first is found, with a
958958
/// uniquely determined position; the second and third are not
959-
/// found; the fourth could match any position in `[1,4]`.
959+
/// found; the fourth could match any position in `[1, 4]`.
960960
///
961-
/// ```rust
961+
/// ```
962962
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
963963
///
964964
/// let seek = 13;
@@ -982,21 +982,23 @@ impl<T> [T] {
982982
/// Binary search a sorted slice with a key extraction function.
983983
///
984984
/// Assumes that the slice is sorted by the key, for instance with
985-
/// `sort_by_key` using the same key extraction function.
985+
/// [`sort_by_key`] using the same key extraction function.
986986
///
987987
/// If a matching value is found then returns `Ok`, containing the
988988
/// index for the matched element; if no match is found then `Err`
989989
/// is returned, containing the index where a matching element could
990990
/// be inserted while maintaining sorted order.
991991
///
992+
/// [`sort_by_key`]: #method.sort_by_key
993+
///
992994
/// # Examples
993995
///
994996
/// Looks up a series of four elements in a slice of pairs sorted by
995997
/// their second elements. The first is found, with a uniquely
996998
/// determined position; the second and third are not found; the
997-
/// fourth could match any position in `[1,4]`.
999+
/// fourth could match any position in `[1, 4]`.
9981000
///
999-
/// ```rust
1001+
/// ```
10001002
/// let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
10011003
/// (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
10021004
/// (1, 21), (2, 34), (4, 55)];
@@ -1023,7 +1025,7 @@ impl<T> [T] {
10231025
///
10241026
/// # Examples
10251027
///
1026-
/// ```rust
1028+
/// ```
10271029
/// let mut v = [-5, 4, 1, -3, 2];
10281030
///
10291031
/// v.sort();
@@ -1045,7 +1047,7 @@ impl<T> [T] {
10451047
///
10461048
/// # Examples
10471049
///
1048-
/// ```rust
1050+
/// ```
10491051
/// let mut v = [-5i32, 4, 1, -3, 2];
10501052
///
10511053
/// v.sort_by_key(|k| k.abs());
@@ -1067,7 +1069,7 @@ impl<T> [T] {
10671069
///
10681070
/// # Examples
10691071
///
1070-
/// ```rust
1072+
/// ```
10711073
/// let mut v = [5, 4, 1, 3, 2];
10721074
/// v.sort_by(|a, b| a.cmp(b));
10731075
/// assert!(v == [1, 2, 3, 4, 5]);
@@ -1094,7 +1096,7 @@ impl<T> [T] {
10941096
///
10951097
/// # Example
10961098
///
1097-
/// ```rust
1099+
/// ```
10981100
/// let mut dst = [0, 0, 0];
10991101
/// let src = [1, 2, 3];
11001102
///
@@ -1116,7 +1118,7 @@ impl<T> [T] {
11161118
///
11171119
/// # Example
11181120
///
1119-
/// ```rust
1121+
/// ```
11201122
/// let mut dst = [0, 0, 0];
11211123
/// let src = [1, 2, 3];
11221124
///

src/libcollections/str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ impl str {
697697
///
698698
/// Basic usage:
699699
///
700-
/// ```rust
700+
/// ```
701701
/// let bananas = "bananas";
702702
///
703703
/// assert!(bananas.ends_with("anas"));
@@ -900,7 +900,7 @@ impl str {
900900
///
901901
/// It does _not_ give you:
902902
///
903-
/// ```rust,ignore
903+
/// ```,ignore
904904
/// assert_eq!(d, &["a", "b", "c"]);
905905
/// ```
906906
///

src/libcollections/string.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//!
2222
//! There are multiple ways to create a new `String` from a string literal:
2323
//!
24-
//! ```rust
24+
//! ```
2525
//! let s = "Hello".to_string();
2626
//!
2727
//! let s = String::from("world");
@@ -31,7 +31,7 @@
3131
//! You can create a new `String` from an existing one by concatenating with
3232
//! `+`:
3333
//!
34-
//! ```rust
34+
//! ```
3535
//! let s = "Hello".to_string();
3636
//!
3737
//! let message = s + " world!";
@@ -40,7 +40,7 @@
4040
//! If you have a vector of valid UTF-8 bytes, you can make a `String` out of
4141
//! it. You can do the reverse too.
4242
//!
43-
//! ```rust
43+
//! ```
4444
//! let sparkle_heart = vec![240, 159, 146, 150];
4545
//!
4646
//! // We know these bytes are valid, so we'll use `unwrap()`.

src/libcollections/vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,7 @@ impl<T> IntoIter<T> {
17691769
///
17701770
/// # Examples
17711771
///
1772-
/// ```rust
1772+
/// ```
17731773
/// # #![feature(vec_into_iter_as_slice)]
17741774
/// let vec = vec!['a', 'b', 'c'];
17751775
/// let mut into_iter = vec.into_iter();
@@ -1788,7 +1788,7 @@ impl<T> IntoIter<T> {
17881788
///
17891789
/// # Examples
17901790
///
1791-
/// ```rust
1791+
/// ```
17921792
/// # #![feature(vec_into_iter_as_slice)]
17931793
/// let vec = vec!['a', 'b', 'c'];
17941794
/// let mut into_iter = vec.into_iter();

src/libcore/cmp.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
//! Functionality for ordering and comparison.
1212
//!
13-
//! This module defines both `PartialOrd` and `PartialEq` traits which are used
13+
//! This module defines both [`PartialOrd`] and [`PartialEq`] traits which are used
1414
//! by the compiler to implement comparison operators. Rust programs may
15-
//! implement `PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators,
16-
//! and may implement `PartialEq` to overload the `==` and `!=` operators.
15+
//! implement [`PartialOrd`] to overload the `<`, `<=`, `>`, and `>=` operators,
16+
//! and may implement [`PartialEq`] to overload the `==` and `!=` operators.
17+
//!
18+
//! [`PartialOrd`]: trait.PartialOrd.html
19+
//! [`PartialEq`]: trait.PartialEq.html
1720
//!
1821
//! # Examples
1922
//!

src/libcore/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ pub trait UpperExp {
794794
/// assert_eq!(output, "Hello world!");
795795
/// ```
796796
///
797-
/// Please note that using [`write!`][write_macro] might be preferrable. Example:
797+
/// Please note that using [`write!`] might be preferrable. Example:
798798
///
799799
/// ```
800800
/// use std::fmt::Write;
@@ -805,7 +805,7 @@ pub trait UpperExp {
805805
/// assert_eq!(output, "Hello world!");
806806
/// ```
807807
///
808-
/// [write_macro]: ../../std/macro.write!.html
808+
/// [`write!`]: ../../std/macro.write.html
809809
#[stable(feature = "rust1", since = "1.0.0")]
810810
pub fn write(output: &mut Write, args: Arguments) -> Result {
811811
let mut formatter = Formatter {

0 commit comments

Comments
 (0)