let-else: build out ref/ref mut tests, with/without explicit annotations · rust-lang/rust@102b912 (original) (raw)
``
1
`+
error[E0308]: mismatched types
`
``
2
`+
--> $DIR/let-else-ref-bindings.rs:16:38
`
``
3
`+
|
`
``
4
`+
LL | let Some(ref a): Option<&[u8]> = some else { return };
`
``
5
`` +
| ^^^^ expected &[u8]
, found struct Vec
``
``
6
`+
|
`
``
7
`` +
= note: expected enum Option<&[u8]>
``
``
8
`` +
found enum Option<Vec<u8>>
``
``
9
+
``
10
`+
error[E0308]: mismatched types
`
``
11
`+
--> $DIR/let-else-ref-bindings.rs:20:38
`
``
12
`+
|
`
``
13
`+
LL | let Some(ref a): Option<&[u8]> = &some else { return };
`
``
14
`` +
| ^^^^^ expected enum Option
, found &Option<Vec<u8>>
``
``
15
`+
|
`
``
16
`` +
= note: expected enum Option<&[u8]>
``
``
17
`` +
found reference &Option<Vec<u8>>
``
``
18
+
``
19
`+
error[E0308]: mismatched types
`
``
20
`+
--> $DIR/let-else-ref-bindings.rs:24:34
`
``
21
`+
|
`
``
22
`+
LL | let Some(a): Option<&[u8]> = some else { return };
`
``
23
`` +
| ^^^^ expected &[u8]
, found struct Vec
``
``
24
`+
|
`
``
25
`` +
= note: expected enum Option<&[u8]>
``
``
26
`` +
found enum Option<Vec<u8>>
``
``
27
+
``
28
`+
error[E0308]: mismatched types
`
``
29
`+
--> $DIR/let-else-ref-bindings.rs:27:34
`
``
30
`+
|
`
``
31
`+
LL | let Some(a): Option<&[u8]> = &some else { return };
`
``
32
`` +
| ^^^^^ expected enum Option
, found &Option<Vec<u8>>
``
``
33
`+
|
`
``
34
`` +
= note: expected enum Option<&[u8]>
``
``
35
`` +
found reference &Option<Vec<u8>>
``
``
36
+
``
37
`+
error[E0308]: mismatched types
`
``
38
`+
--> $DIR/let-else-ref-bindings.rs:44:46
`
``
39
`+
|
`
``
40
`+
LL | let Some(ref mut a): Option<&mut [u8]> = some else { return };
`
``
41
`` +
| ^^^^ expected &mut [u8]
, found struct Vec
``
``
42
`+
|
`
``
43
`` +
= note: expected enum Option<&mut [u8]>
``
``
44
`` +
found enum Option<Vec<u8>>
``
``
45
+
``
46
`+
error[E0308]: mismatched types
`
``
47
`+
--> $DIR/let-else-ref-bindings.rs:48:46
`
``
48
`+
|
`
``
49
`+
LL | let Some(ref mut a): Option<&mut [u8]> = &mut some else { return };
`
``
50
`` +
| ^^^^^^^^^ expected enum Option
, found mutable reference
``
``
51
`+
|
`
``
52
`` +
= note: expected enum Option<&mut [u8]>
``
``
53
`` +
found mutable reference &mut Option<Vec<u8>>
``
``
54
+
``
55
`+
error[E0308]: mismatched types
`
``
56
`+
--> $DIR/let-else-ref-bindings.rs:52:38
`
``
57
`+
|
`
``
58
`+
LL | let Some(a): Option<&mut [u8]> = some else { return };
`
``
59
`` +
| ^^^^ expected &mut [u8]
, found struct Vec
``
``
60
`+
|
`
``
61
`` +
= note: expected enum Option<&mut [u8]>
``
``
62
`` +
found enum Option<Vec<u8>>
``
``
63
+
``
64
`+
error[E0308]: mismatched types
`
``
65
`+
--> $DIR/let-else-ref-bindings.rs:55:38
`
``
66
`+
|
`
``
67
`+
LL | let Some(a): Option<&mut [u8]> = &mut some else { return };
`
``
68
`` +
| ^^^^^^^^^ expected enum Option
, found mutable reference
``
``
69
`+
|
`
``
70
`` +
= note: expected enum Option<&mut [u8]>
``
``
71
`` +
found mutable reference &mut Option<Vec<u8>>
``
``
72
+
``
73
`+
error: aborting due to 8 previous errors
`
``
74
+
``
75
`` +
For more information about this error, try rustc --explain E0308
.
``