Skip to content

Commit 21dd59f

Browse files
committed
Update tests for new TRPL chapter order
1 parent 99832cb commit 21dd59f

File tree

57 files changed

+139
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+139
-139
lines changed

compiler/rustc_hir_typeck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn report_unexpected_variant_res(
364364
.with_code(err_code);
365365
match res {
366366
Res::Def(DefKind::Fn | DefKind::AssocFn, _) if err_code == E0164 => {
367-
let patterns_url = "https://doc.rust-lang.org/book/ch18-00-patterns.html";
367+
let patterns_url = "https://doc.rust-lang.org/book/ch19-00-patterns.html";
368368
err.with_span_label(span, "`fn` calls are not allowed in patterns")
369369
.with_help(format!("for more information, visit {patterns_url}"))
370370
}

compiler/rustc_resolve/src/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
12061206
let PathSource::TupleStruct(_, _) = source else { return };
12071207
let Some(Res::Def(DefKind::Fn, _)) = res else { return };
12081208
err.primary_message("expected a pattern, found a function call");
1209-
err.note("function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>");
1209+
err.note("function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>");
12101210
}
12111211

12121212
fn suggest_changing_type_to_const_param(

tests/ui/closures/2229_closure_analysis/bad-pattern.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let 0 = v1;
55
| ^ pattern `1_u32..=u32::MAX` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `u32`
1010
help: you might want to use `if let` to ignore the variant that isn't matched
1111
|
@@ -23,7 +23,7 @@ LL | let (0 | 1) = v1;
2323
| ^^^^^ pattern `2_u32..=u32::MAX` not covered
2424
|
2525
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
26-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
26+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2727
= note: the matched value is of type `u32`
2828
help: you might want to use `if let` to ignore the variant that isn't matched
2929
|
@@ -37,7 +37,7 @@ LL | let 1.. = v1;
3737
| ^^^ pattern `0_u32` not covered
3838
|
3939
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
40-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
40+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
4141
= note: the matched value is of type `u32`
4242
help: you might want to use `if let` to ignore the variant that isn't matched
4343
|
@@ -51,7 +51,7 @@ LL | let [0, 0, 0, 0] = v2;
5151
| ^^^^^^^^^^^^ pattern `[1_u32..=u32::MAX, _, _, _]` not covered
5252
|
5353
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
54-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
54+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
5555
= note: the matched value is of type `[u32; 4]`
5656
help: you might want to use `if let` to ignore the variant that isn't matched
5757
|
@@ -65,7 +65,7 @@ LL | let [0] = v4;
6565
| ^^^ patterns `&[]` and `&[_, _, ..]` not covered
6666
|
6767
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
68-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
68+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
6969
= note: the matched value is of type `&[u32]`
7070
help: you might want to use `if let` to ignore the variants that aren't matched
7171
|
@@ -79,7 +79,7 @@ LL | let Refutable::A = v3;
7979
| ^^^^^^^^^^^^ pattern `Refutable::B` not covered
8080
|
8181
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
82-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
82+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
8383
note: `Refutable` defined here
8484
--> $DIR/bad-pattern.rs:4:6
8585
|
@@ -104,7 +104,7 @@ LL | let PAT = v1;
104104
| ^^^ pattern `1_u32..=u32::MAX` not covered
105105
|
106106
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
107-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
107+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
108108
= note: the matched value is of type `u32`
109109
help: introduce a variable instead
110110
|

tests/ui/consts/const-match-check.eval1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | A = { let 0 = 0; 0 },
55
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `i32`
1010
help: you might want to use `if let` to ignore the variants that aren't matched
1111
|

tests/ui/consts/const-match-check.eval2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let x: [i32; { let 0 = 0; 0 }] = [];
55
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `i32`
1010
help: you might want to use `if let` to ignore the variants that aren't matched
1111
|

tests/ui/consts/const-match-check.matchck.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | const X: i32 = { let 0 = 0; 0 };
55
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `i32`
1010
help: you might want to use `if let` to ignore the variants that aren't matched
1111
|
@@ -23,7 +23,7 @@ LL | static Y: i32 = { let 0 = 0; 0 };
2323
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
2424
|
2525
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
26-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
26+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2727
= note: the matched value is of type `i32`
2828
help: you might want to use `if let` to ignore the variants that aren't matched
2929
|
@@ -41,7 +41,7 @@ LL | const X: i32 = { let 0 = 0; 0 };
4141
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
4242
|
4343
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
44-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
44+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
4545
= note: the matched value is of type `i32`
4646
help: you might want to use `if let` to ignore the variants that aren't matched
4747
|
@@ -59,7 +59,7 @@ LL | const X: i32 = { let 0 = 0; 0 };
5959
| ^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered
6060
|
6161
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
62-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
62+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
6363
= note: the matched value is of type `i32`
6464
help: you might want to use `if let` to ignore the variants that aren't matched
6565
|

tests/ui/consts/const-pattern-irrefutable.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | let a = 4;
88
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
99
|
1010
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
11-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
11+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1212
= note: the matched value is of type `u8`
1313
help: introduce a variable instead
1414
|
@@ -25,7 +25,7 @@ LL | let c = 4;
2525
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
2626
|
2727
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
28-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
28+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2929
= note: the matched value is of type `u8`
3030
help: introduce a variable instead
3131
|
@@ -42,7 +42,7 @@ LL | let d = (4, 4);
4242
| ^ patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
4343
|
4444
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
45-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
45+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
4646
= note: the matched value is of type `(u8, u8)`
4747
help: introduce a variable instead
4848
|
@@ -59,7 +59,7 @@ LL | let e = S {
5959
| ^ pattern `S { foo: 1_u8..=u8::MAX }` not covered
6060
|
6161
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
62-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
62+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
6363
note: `S` defined here
6464
--> $DIR/const-pattern-irrefutable.rs:15:8
6565
|

tests/ui/destructuring-assignment/non-exhaustive-destructure.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | None = Some(3);
55
| ^^^^ pattern `Some(_)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `Option<i32>`
1010
help: you might want to use `if let` to ignore the variant that isn't matched
1111
|

tests/ui/empty/empty-never-array.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let Helper::U(u) = Helper::T(t, []);
55
| ^^^^^^^^^^^^ pattern `Helper::T(_, _)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
note: `Helper<T, U>` defined here
1010
--> $DIR/empty-never-array.rs:3:6
1111
|

tests/ui/error-codes/E0005.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let Some(y) = x;
55
| ^^^^^^^ pattern `None` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `Option<i32>`
1010
help: you might want to use `let else` to handle the variant that isn't matched
1111
|

tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let Ok(_x) = &foo();
55
| ^^^^^^ pattern `&Err(_)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `&Result<u32, !>`
1010
help: you might want to use `let else` to handle the variant that isn't matched
1111
|

tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `[i32::MIN..=2_i32, ..]` not covered
1616
|
1717
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
18-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
18+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1919
= note: the matched value is of type `[i32; 8]`
2020
help: you might want to use `let else` to handle the variant that isn't matched
2121
|

tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ LL | mac!(0);
6767
| ------- in this macro invocation
6868
|
6969
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
70-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
70+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
7171
= note: the matched value is of type `i32`
7272
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
7373

tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ LL | mac!(0);
9494
| ------- in this macro invocation
9595
|
9696
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
97-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
97+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
9898
= note: the matched value is of type `i32`
9999
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
100100

@@ -108,7 +108,7 @@ LL | mac!(0);
108108
| ------- in this macro invocation
109109
|
110110
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
111-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
111+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
112112
= note: the matched value is of type `i32`
113113
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
114114

tests/ui/half-open-range-patterns/range_pat_interactions1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: expected a pattern range bound, found an expression
44
LL | 0..5+1 => errors_only.push(x),
55
| ^^^ not a pattern
66
|
7-
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
7+
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
88
help: consider extracting the expression into a `const`
99
|
1010
LL + const VAL: /* Type */ = 5+1;

tests/ui/half-open-range-patterns/range_pat_interactions2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error: expected a pattern range bound, found an expression
1616
LL | 0..=(5+1) => errors_only.push(x),
1717
| ^^^ not a pattern
1818
|
19-
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
19+
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
2020
help: consider extracting the expression into a `const`
2121
|
2222
LL + const VAL: /* Type */ = 5+1;

tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `[i32::MIN..=2_i32, ..]` not covered
1616
|
1717
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
18-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
18+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1919
= note: the matched value is of type `[i32; 8]`
2020
help: you might want to use `let else` to handle the variant that isn't matched
2121
|

tests/ui/issues/issue-55587.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0164]: expected tuple struct or tuple variant, found associated function
44
LL | let Path::new();
55
| ^^^^^^^^^^^ `fn` calls are not allowed in patterns
66
|
7-
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
7+
= help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html
88

99
error: aborting due to 1 previous error
1010

tests/ui/let-else/uninitialized-refutable-let-issue-123844.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let Some(x);
55
| ^^^^^^^ pattern `None` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
8-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
8+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `Option<i32>`
1010

1111
error: aborting due to 1 previous error

tests/ui/loops/loop-else-break-with-value.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | let Some(1) = loop {
2121
| ^^^^^^^ pattern `None` not covered
2222
|
2323
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
24-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
24+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2525
= note: the matched value is of type `Option<i32>`
2626
help: you might want to use `if let` to ignore the variant that isn't matched
2727
|

tests/ui/match/match-fn-call.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0164]: expected tuple struct or tuple variant, found associated function
44
LL | Path::new("foo") => println!("foo"),
55
| ^^^^^^^^^^^^^^^^ `fn` calls are not allowed in patterns
66
|
7-
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
7+
= help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html
88

99
error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new`
1010
--> $DIR/match-fn-call.rs:8:9
1111
|
1212
LL | Path::new("bar") => println!("bar"),
1313
| ^^^^^^^^^^^^^^^^ `fn` calls are not allowed in patterns
1414
|
15-
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
15+
= help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html
1616

1717
error: aborting due to 2 previous errors
1818

tests/ui/mir/issue-112269.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let x: i32 = 3;
77
| ^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
88
|
99
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
10-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
10+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1111
= note: the matched value is of type `i32`
1212
help: introduce a variable instead
1313
|
@@ -23,7 +23,7 @@ LL | let y = 4;
2323
| ^ patterns `i32::MIN..=2_i32` and `4_i32..=i32::MAX` not covered
2424
|
2525
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
26-
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
26+
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2727
= note: the matched value is of type `i32`
2828
help: introduce a variable instead
2929
|

0 commit comments

Comments
 (0)