fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.7 KiB56 linesraw
1error[E0308]: mismatched types
2  --> $DIR/match-ergonomics.rs:4:10
3   |
4LL |     match &x[..] {
5   |           ------ this expression has type `&[i32]`
6LL |         [&v] => {},
7   |          ^^
8   |          |
9   |          expected `i32`, found reference
10   |          help: you can probably remove the explicit borrow: `v`
11   |
12   = note:   expected type `i32`
13           found reference `&_`
14
15error[E0529]: expected an array or slice, found `std::vec::Vec<i32>`
16  --> $DIR/match-ergonomics.rs:8:9
17   |
18LL |         [&v] => {},
19   |         ^^^^ pattern cannot match with input type `std::vec::Vec<i32>`
20
21error[E0529]: expected an array or slice, found `std::vec::Vec<i32>`
22  --> $DIR/match-ergonomics.rs:20:9
23   |
24LL |         [v] => {},
25   |         ^^^ pattern cannot match with input type `std::vec::Vec<i32>`
26
27error[E0308]: mismatched types
28  --> $DIR/match-ergonomics.rs:29:9
29   |
30LL |     match y {
31   |           - this expression has type `i32`
32LL |         &v => {},
33   |         ^^
34   |         |
35   |         expected `i32`, found reference
36   |         help: you can probably remove the explicit borrow: `v`
37   |
38   = note:   expected type `i32`
39           found reference `&_`
40
41error[E0308]: mismatched types
42  --> $DIR/match-ergonomics.rs:40:13
43   |
44LL |     if let [&v] = &x[..] {}
45   |             ^^    ------ this expression has type `&[i32]`
46   |             |
47   |             expected `i32`, found reference
48   |             help: you can probably remove the explicit borrow: `v`
49   |
50   = note:   expected type `i32`
51           found reference `&_`
52
53error: aborting due to 5 previous errors
54
55Some errors have detailed explanations: E0308, E0529.
56For more information about an error, try `rustc --explain E0308`.