fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB43 linesraw
1error[E0308]: mismatched types
2  --> $DIR/issue-76191.rs:13:9
3   |
4LL | const RANGE: RangeInclusive<i32> = 0..=255;
5   | -------------------------------- constant defined here
6...
7LL |     match n {
8   |           - this expression has type `i32`
9LL |         RANGE => {}
10   |         ^^^^^
11   |         |
12   |         expected `i32`, found `RangeInclusive<i32>`
13   |         `RANGE` is interpreted as a constant, not a new binding
14   |
15   = note: expected type `i32`
16            found struct `RangeInclusive<i32>`
17help: you may want to move the range into the match block
18   |
19LL |         0..=255 => {}
20   |         ~~~~~~~
21
22error[E0308]: mismatched types
23  --> $DIR/issue-76191.rs:15:9
24   |
25LL | const RANGE2: RangeInclusive<i32> = panic!();
26   | --------------------------------- constant defined here
27...
28LL |     match n {
29   |           - this expression has type `i32`
30...
31LL |         RANGE2 => {}
32   |         ^^^^^^
33   |         |
34   |         expected `i32`, found `RangeInclusive<i32>`
35   |         `RANGE2` is interpreted as a constant, not a new binding
36   |
37   = note: expected type `i32`
38            found struct `RangeInclusive<i32>`
39   = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block
40
41error: aborting due to 2 previous errors
42
43For more information about this error, try `rustc --explain E0308`.