@@ -37,7 +37,52 @@ LL + Ok(())
37
37
|
38
38
39
39
error[E0308]: mismatched types
40
- --> $DIR/compatible-variants.rs:27:25
40
+ --> $DIR/compatible-variants.rs:27:5
41
+ |
42
+ LL | fn c() -> Option<()> {
43
+ | ---------- expected `Option<()>` because of return type
44
+ LL | / for _ in [1, 2] {
45
+ LL | |
46
+ LL | | f();
47
+ LL | | }
48
+ | |_____^ expected enum `Option`, found `()`
49
+ |
50
+ = note: expected enum `Option<()>`
51
+ found unit type `()`
52
+ help: try adding an expression at the end of the block
53
+ |
54
+ LL ~ }
55
+ LL + None
56
+ |
57
+ LL ~ }
58
+ LL + Some(())
59
+ |
60
+
61
+ error[E0308]: `?` operator has incompatible types
62
+ --> $DIR/compatible-variants.rs:35:5
63
+ |
64
+ LL | c()?
65
+ | ^^^^ expected enum `Option`, found `()`
66
+ |
67
+ = note: `?` operator cannot convert from `()` to `Option<()>`
68
+ = note: expected enum `Option<()>`
69
+ found unit type `()`
70
+ help: try removing this `?`
71
+ |
72
+ LL - c()?
73
+ LL + c()
74
+ |
75
+ help: try adding an expression at the end of the block
76
+ |
77
+ LL ~ c()?;
78
+ LL + None
79
+ |
80
+ LL ~ c()?;
81
+ LL + Some(())
82
+ |
83
+
84
+ error[E0308]: mismatched types
85
+ --> $DIR/compatible-variants.rs:42:25
41
86
|
42
87
LL | let _: Option<()> = while false {};
43
88
| ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
@@ -52,7 +97,7 @@ LL | let _: Option<()> = Some(while false {});
52
97
| +++++ +
53
98
54
99
error[E0308]: mismatched types
55
- --> $DIR/compatible-variants.rs:31 :9
100
+ --> $DIR/compatible-variants.rs:46 :9
56
101
|
57
102
LL | while false {}
58
103
| ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
@@ -69,7 +114,7 @@ LL + Some(())
69
114
|
70
115
71
116
error[E0308]: mismatched types
72
- --> $DIR/compatible-variants.rs:35 :31
117
+ --> $DIR/compatible-variants.rs:50 :31
73
118
|
74
119
LL | let _: Result<i32, i32> = 1;
75
120
| ---------------- ^ expected enum `Result`, found integer
@@ -86,7 +131,7 @@ LL | let _: Result<i32, i32> = Err(1);
86
131
| ++++ +
87
132
88
133
error[E0308]: mismatched types
89
- --> $DIR/compatible-variants.rs:38 :26
134
+ --> $DIR/compatible-variants.rs:53 :26
90
135
|
91
136
LL | let _: Option<i32> = 1;
92
137
| ----------- ^ expected enum `Option`, found integer
@@ -101,7 +146,7 @@ LL | let _: Option<i32> = Some(1);
101
146
| +++++ +
102
147
103
148
error[E0308]: mismatched types
104
- --> $DIR/compatible-variants.rs:41 :28
149
+ --> $DIR/compatible-variants.rs:56 :28
105
150
|
106
151
LL | let _: Hey<i32, i32> = 1;
107
152
| ------------- ^ expected enum `Hey`, found integer
@@ -118,7 +163,7 @@ LL | let _: Hey<i32, i32> = Hey::B(1);
118
163
| +++++++ +
119
164
120
165
error[E0308]: mismatched types
121
- --> $DIR/compatible-variants.rs:44 :29
166
+ --> $DIR/compatible-variants.rs:59 :29
122
167
|
123
168
LL | let _: Hey<i32, bool> = false;
124
169
| -------------- ^^^^^ expected enum `Hey`, found `bool`
@@ -133,7 +178,7 @@ LL | let _: Hey<i32, bool> = Hey::B(false);
133
178
| +++++++ +
134
179
135
180
error[E0308]: mismatched types
136
- --> $DIR/compatible-variants.rs:48 :19
181
+ --> $DIR/compatible-variants.rs:63 :19
137
182
|
138
183
LL | let _ = Foo { bar };
139
184
| ^^^ expected enum `Option`, found `i32`
@@ -145,6 +190,6 @@ help: try wrapping the expression in `Some`
145
190
LL | let _ = Foo { bar: Some(bar) };
146
191
| ++++++++++ +
147
192
148
- error: aborting due to 9 previous errors
193
+ error: aborting due to 11 previous errors
149
194
150
195
For more information about this error, try `rustc --explain E0308`.
0 commit comments