Skip to content

Commit d9a328a

Browse files
committed
Auto merge of rust-lang#69424 - pietroalbini:rollup-3oelogm, r=pietroalbini
Rollup of 5 pull requests Successful merges: - rust-lang#69372 (Updates links in various Compiler Error Index entries) - rust-lang#69385 (Relax str::get_unchecked precondition to permit empty slicing) - rust-lang#69386 (Fix minor error in `MaybeUninit::get_mut()` doc example) - rust-lang#69394 (Clean up E0367 explanation) - rust-lang#69405 (docs: Stdin::read_line: mention the appending) Failed merges: r? @ghost
2 parents 79cd224 + ba3fee6 commit d9a328a

33 files changed

+122
-79
lines changed

src/libcore/mem/maybe_uninit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<T> MaybeUninit<T> {
669669
/// // Now we can use `buf` as a normal slice:
670670
/// buf.sort_unstable();
671671
/// assert!(
672-
/// buf.chunks(2).all(|chunk| chunk[0] <= chunk[1]),
672+
/// buf.windows(2).all(|pair| pair[0] <= pair[1]),
673673
/// "buffer is sorted",
674674
/// );
675675
/// ```

src/libcore/str/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ impl str {
24862486
/// Callers of this function are responsible that these preconditions are
24872487
/// satisfied:
24882488
///
2489-
/// * The starting index must come before the ending index;
2489+
/// * The starting index must not exceed the ending index;
24902490
/// * Indexes must be within bounds of the original slice;
24912491
/// * Indexes must lie on UTF-8 sequence boundaries.
24922492
///
@@ -2518,7 +2518,7 @@ impl str {
25182518
/// Callers of this function are responsible that these preconditions are
25192519
/// satisfied:
25202520
///
2521-
/// * The starting index must come before the ending index;
2521+
/// * The starting index must not exceed the ending index;
25222522
/// * Indexes must be within bounds of the original slice;
25232523
/// * Indexes must lie on UTF-8 sequence boundaries.
25242524
///
@@ -2563,7 +2563,7 @@ impl str {
25632563
/// Callers of this function are responsible that three preconditions are
25642564
/// satisfied:
25652565
///
2566-
/// * `begin` must come before `end`.
2566+
/// * `begin` must not exceed `end`.
25672567
/// * `begin` and `end` must be byte positions within the string slice.
25682568
/// * `begin` and `end` must lie on UTF-8 sequence boundaries.
25692569
///
@@ -2612,7 +2612,7 @@ impl str {
26122612
/// Callers of this function are responsible that three preconditions are
26132613
/// satisfied:
26142614
///
2615-
/// * `begin` must come before `end`.
2615+
/// * `begin` must not exceed `end`.
26162616
/// * `begin` and `end` must be byte positions within the string slice.
26172617
/// * `begin` and `end` must lie on UTF-8 sequence boundaries.
26182618
#[stable(feature = "str_slice_mut", since = "1.5.0")]

src/librustc_error_codes/error_codes/E0080.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ constant expression that had to be evaluated. Attempting to divide by 0
1414
or causing an integer overflow are two ways to induce this error.
1515

1616
Ensure that the expressions given can be evaluated as the desired integer type.
17-
See the FFI section of the Reference for more information about using a custom
18-
integer type:
1917

20-
https://doc.rust-lang.org/reference.html#ffi-attributes
18+
See the [Custom Discriminants][custom-discriminants] section of the Reference
19+
for more information about setting custom integer types on fieldless enums
20+
using the [`repr` attribute][repr-attribute].
21+
22+
[custom-discriminants]: https://doc.rust-lang.org/reference/items/enumerations.html#custom-discriminant-values-for-field-less-enumerations
23+
[repr-attribute]: https://doc.rust-lang.org/reference/type-layout.html#reprc-enums

src/librustc_error_codes/error_codes/E0133.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ fn main() {
2828
}
2929
```
3030

31-
See also https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html
31+
See the [unsafe section][unsafe-section] of the Book for more details.
32+
33+
[unsafe-section]: https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

src/librustc_error_codes/error_codes/E0154.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ fn f() {
2727
}
2828
```
2929

30-
See the Declaration Statements section of the reference for more information
31-
about what constitutes an Item declaration and what does not:
30+
See the [Declaration Statements][declaration-statements] section of the
31+
reference for more information about what constitutes an item declaration
32+
and what does not.
3233

33-
https://doc.rust-lang.org/reference.html#statements
34+
[declaration-statements]: https://doc.rust-lang.org/reference/statements.html#declaration-statements

src/librustc_error_codes/error_codes/E0260.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ extern crate core as xyz;
2828
struct abc;
2929
```
3030

31-
See the Declaration Statements section of the reference for more information
32-
about what constitutes an Item declaration and what does not:
31+
See the [Declaration Statements][declaration-statements] section of the
32+
reference for more information about what constitutes an item declaration
33+
and what does not.
3334

34-
https://doc.rust-lang.org/reference.html#statements
35+
[declaration-statements]: https://doc.rust-lang.org/reference/statements.html#declaration-statements

src/librustc_error_codes/error_codes/E0303.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ match Some("hi".to_string()) {
3333

3434
The `op_string_ref` binding has type `&Option<&String>` in both cases.
3535

36-
See also https://github.com/rust-lang/rust/issues/14587
36+
See also [Issue 14587][issue-14587].
37+
38+
[issue-14587]: https://github.com/rust-lang/rust/issues/14587

src/librustc_error_codes/error_codes/E0364.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub use foo::X;
2626
fn main() {}
2727
```
2828

29-
See the 'Use Declarations' section of the reference for more information on
30-
this topic:
29+
See the [Use Declarations][use-declarations] section of the reference for
30+
more information on this topic.
3131

32-
https://doc.rust-lang.org/reference.html#use-declarations
32+
[use-declarations]: https://doc.rust-lang.org/reference/items/use-declarations.html

src/librustc_error_codes/error_codes/E0365.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub use foo as foo2;
2626
fn main() {}
2727
```
2828

29-
See the 'Use Declarations' section of the reference for more information
30-
on this topic:
29+
See the [Use Declarations][use-declarations] section of the reference for
30+
more information on this topic.
3131

32-
https://doc.rust-lang.org/reference.html#use-declarations
32+
[use-declarations]: https://doc.rust-lang.org/reference/items/use-declarations.html

src/librustc_error_codes/error_codes/E0367.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
An attempt was made to implement `Drop` on a specialization of a generic type.
2-
An example is shown below:
2+
3+
Erroneous code example:
34

45
```compile_fail,E0367
5-
trait Foo{}
6+
trait Foo {}
67
78
struct MyStruct<T> {
89
t: T

src/librustc_error_codes/error_codes/E0382.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ With this approach, x and y share ownership of the data via the `Rc` (reference
104104
count type). `RefCell` essentially performs runtime borrow checking: ensuring
105105
that at most one writer or multiple readers can access the data at any one time.
106106

107-
If you wish to learn more about ownership in Rust, start with the chapter in the
108-
Book:
107+
If you wish to learn more about ownership in Rust, start with the
108+
[Understanding Ownership][understanding-ownership] chapter in the Book.
109109

110-
https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
110+
[understanding-ownership]: https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html

src/librustc_error_codes/error_codes/E0387.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ fn mutable() {
5252
}
5353
```
5454

55-
You can read more about cell types in the API documentation:
55+
You can read more in the API documentation for [Cell][std-cell].
5656

57-
https://doc.rust-lang.org/std/cell/
57+
[std-cell]: https://doc.rust-lang.org/std/cell/

src/librustc_error_codes/error_codes/E0455.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ To solve this error you can use conditional compilation:
1515
extern {}
1616
```
1717

18-
See more:
19-
https://doc.rust-lang.org/reference/attributes.html#conditional-compilation
18+
Learn more in the [Conditional Compilation][conditional-compilation] section
19+
of the Reference.
20+
21+
[conditional-compilation]: https://doc.rust-lang.org/reference/attributes.html#conditional-compilation

src/librustc_error_codes/error_codes/E0499.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ x;
1010
// error: cannot borrow `i` as mutable more than once at a time
1111
```
1212

13-
Please note that in rust, you can either have many immutable references, or one
14-
mutable reference. Take a look at
15-
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html for more
16-
information. Example:
13+
Please note that in Rust, you can either have many immutable references, or one
14+
mutable reference. For more details you may want to read the
15+
[References & Borrowing][references-and-borrowing] section of the Book.
1716

17+
[references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
18+
19+
Example:
1820

1921
```
2022
let mut i = 0;

src/librustc_error_codes/error_codes/E0501.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ captured by a closure. Because the closure has borrowed the variable, it is not
33
available for use until the closure goes out of scope.
44

55
Note that a capture will either move or borrow a variable, but in this
6-
situation, the closure is borrowing the variable. Take a look at
7-
http://rustbyexample.com/fn/closures/capture.html for more information about
8-
capturing.
6+
situation, the closure is borrowing the variable. Take a look at the chapter
7+
on [Capturing][capturing] in Rust By Example for more information.
8+
9+
[capturing]: https://doc.rust-lang.org/stable/rust-by-example/fn/closures/capture.html
910

1011
Erroneous code example:
1112

src/librustc_error_codes/error_codes/E0502.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ fn foo(a: &mut i32) {
2525
}
2626
```
2727

28-
For more information on the rust ownership system, take a look at
29-
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html.
28+
For more information on Rust's ownership system, take a look at the
29+
[References & Borrowing][references-and-borrowing] section of the Book.
30+
31+
[references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html

src/librustc_error_codes/error_codes/E0503.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@ fn main() {
4848
}
4949
```
5050

51-
You can find more information about borrowing in the rust-book:
52-
http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
51+
For more information on Rust's ownership system, take a look at the
52+
[References & Borrowing][references-and-borrowing] section of the Book.
53+
54+
[references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html

src/librustc_error_codes/error_codes/E0505.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,7 @@ fn main() {
8181
}
8282
```
8383

84-
You can find more information about borrowing in the rust-book:
85-
http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
84+
For more information on Rust's ownership system, take a look at the
85+
[References & Borrowing][references-and-borrowing] section of the Book.
86+
87+
[references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html

src/librustc_error_codes/error_codes/E0507.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,7 @@ let borrowed = &mut cave;
127127
mem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok!
128128
```
129129

130-
You can find more information about borrowing in the rust-book:
131-
http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
130+
For more information on Rust's ownership system, take a look at the
131+
[References & Borrowing][references-and-borrowing] section of the Book.
132+
133+
[references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html

src/librustc_error_codes/error_codes/E0525.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ fn main() {
3636
}
3737
```
3838

39-
To understand better how closures work in Rust, read:
40-
https://doc.rust-lang.org/book/ch13-01-closures.html
39+
To better understand how these work in Rust, read the [Closures][closures]
40+
chapter of the Book.
41+
42+
[closures]: https://doc.rust-lang.org/book/ch13-01-closures.html

src/librustc_error_codes/error_codes/E0534.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ compiler about inlining opportunity:
3131
fn something() {}
3232
```
3333

34-
For more information about the inline attribute, read:
35-
https://doc.rust-lang.org/reference.html#inline-attributes
34+
For more information see the [`inline` attribute][inline-attribute] section
35+
of the Reference.
36+
37+
[inline-attribute]: https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute

src/librustc_error_codes/error_codes/E0535.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ pub fn something() {}
2424
fn main() {}
2525
```
2626

27-
For more information about the inline attribute, https:
28-
read://doc.rust-lang.org/reference.html#inline-attributes
27+
For more information see the [`inline` Attribute][inline-attribute] section
28+
of the Reference.
29+
30+
[inline-attribute]: https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute

src/librustc_error_codes/error_codes/E0536.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ pub fn something() {}
1818
pub fn main() {}
1919
```
2020

21-
For more information about the cfg attribute, read:
22-
https://doc.rust-lang.org/reference.html#conditional-compilation
21+
For more information about the `cfg` attribute, read the section on
22+
[Conditional Compilation][conditional-compilation] in the Reference.
23+
24+
[conditional-compilation]: https://doc.rust-lang.org/reference/conditional-compilation.html

src/librustc_error_codes/error_codes/E0537.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ pub fn something() {}
2424
pub fn main() {}
2525
```
2626

27-
For more information about the cfg attribute, read:
28-
https://doc.rust-lang.org/reference.html#conditional-compilation
27+
For more information about the `cfg` attribute, read the section on
28+
[Conditional Compilation][conditional-compilation] in the Reference.
29+
30+
[conditional-compilation]: https://doc.rust-lang.org/reference/conditional-compilation.html

src/librustc_error_codes/error_codes/E0601.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ fn main() {
88
}
99
```
1010

11-
If you don't know the basics of Rust, you can go look to the Rust Book to get
12-
started: https://doc.rust-lang.org/book/
11+
If you don't know the basics of Rust, you can look at the
12+
[Rust Book][rust-book] to get started.
13+
14+
[rust-book]: https://doc.rust-lang.org/book/

src/librustc_error_codes/error_codes/E0610.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let variable = Foo { x: 0, y: -12 };
2424
println!("x: {}, y: {}", variable.x, variable.y);
2525
```
2626

27-
For more information about primitives and structs, take a look at The Book:
28-
https://doc.rust-lang.org/book/ch03-02-data-types.html
29-
https://doc.rust-lang.org/book/ch05-00-structs.html
27+
For more information about [primitives] and [structs], take a look at the Book.
28+
29+
[primitives]: https://doc.rust-lang.org/book/ch03-02-data-types.html
30+
[structs]: https://doc.rust-lang.org/book/ch05-00-structs.html

src/librustc_error_codes/error_codes/E0660.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Erroneous code example:
66
asm!("nop" "nop");
77
```
88

9-
Considering that this would be a long explanation, we instead recommend you to
10-
take a look at the unstable book:
11-
https://doc.rust-lang.org/unstable-book/language-features/asm.html
9+
Considering that this would be a long explanation, we instead recommend you
10+
take a look at the [`asm`] chapter of the Unstable book:
11+
12+
[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html

src/librustc_error_codes/error_codes/E0661.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let a;
77
asm!("nop" : "r"(a));
88
```
99

10-
Considering that this would be a long explanation, we instead recommend you to
11-
take a look at the unstable book:
12-
https://doc.rust-lang.org/unstable-book/language-features/asm.html
10+
Considering that this would be a long explanation, we instead recommend you
11+
take a look at the [`asm`] chapter of the Unstable book:
12+
13+
[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html

src/librustc_error_codes/error_codes/E0662.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ asm!("xor %eax, %eax"
99
);
1010
```
1111

12-
Considering that this would be a long explanation, we instead recommend you to
13-
take a look at the unstable book:
14-
https://doc.rust-lang.org/unstable-book/language-features/asm.html
12+
Considering that this would be a long explanation, we instead recommend you
13+
take a look at the [`asm`] chapter of the Unstable book:
14+
15+
[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html

src/librustc_error_codes/error_codes/E0663.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ asm!("xor %eax, %eax"
99
);
1010
```
1111

12-
Considering that this would be a long explanation, we instead recommend you to
13-
take a look at the unstable book:
14-
https://doc.rust-lang.org/unstable-book/language-features/asm.html
12+
Considering that this would be a long explanation, we instead recommend you
13+
take a look at the [`asm`] chapter of the Unstable book:
14+
15+
[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html

src/librustc_error_codes/error_codes/E0664.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ asm!("mov $$0x200, %eax"
1010
);
1111
```
1212

13-
Considering that this would be a long explanation, we instead recommend you to
14-
take a look at the unstable book:
15-
https://doc.rust-lang.org/unstable-book/language-features/asm.html
13+
Considering that this would be a long explanation, we instead recommend you
14+
take a look at the [`asm`] chapter of the Unstable book:
15+
16+
[asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/asm.html

src/libstd/io/stdio.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl Stdin {
302302
StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
303303
}
304304

305-
/// Locks this handle and reads a line of input into the specified buffer.
305+
/// Locks this handle and reads a line of input, appending it to the specified buffer.
306306
///
307307
/// For detailed semantics of this method, see the documentation on
308308
/// [`BufRead::read_line`].

src/test/ui/json-short.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ fn main() {
88
}
99
```
1010

11-
If you don't know the basics of Rust, you can go look to the Rust Book to get
12-
started: https://doc.rust-lang.org/book/
11+
If you don't know the basics of Rust, you can look at the
12+
[Rust Book][rust-book] to get started.
13+
14+
[rust-book]: https://doc.rust-lang.org/book/
1315
"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":62,"byte_end":62,"line_start":1,"line_end":1,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:63: error[E0601]: `main` function not found in crate `json_short`
1416
"}
1517
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error

0 commit comments

Comments
 (0)