Skip to content

Commit e943f94

Browse files
committed
wip
1 parent dbf856c commit e943f94

5 files changed

+16
-11
lines changed

Diff for: src/test/ui/if/if-let-arm-types.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
fn main() {
22
if let Some(b) = None {
3-
//~^ NOTE if let` arms have incompatible types
3+
//~^ NOTE if and else have incompatible types
44
()
5+
//~^ NOTE expected because of this
56
} else {
67
1
78
};
8-
//~^^ ERROR: `if let` arms have incompatible types
9+
//~^^ ERROR: if and else have incompatible types
910
//~| NOTE expected (), found integer
1011
//~| NOTE expected type `()`
1112
}

Diff for: src/test/ui/if/if-let-arm-types.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
error[E0308]: if and else have incompatible types
2-
--> $DIR/if-let-arm-types.rs:6:9
2+
--> $DIR/if-let-arm-types.rs:7:9
33
|
44
LL | / if let Some(b) = None {
55
LL | |
66
LL | | ()
77
| | -- expected because of this
8+
LL | |
89
LL | | } else {
910
LL | | 1
1011
| | ^ expected (), found integer

Diff for: src/test/ui/if/if-without-else-as-fn-expr.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ fn foo(bar: usize) -> usize {
33
return 3;
44
}
55
//~^^^ ERROR if may be missing an else clause
6+
//~| ERROR mismatched types [E0308]
67
}
78

89
fn foo2(bar: usize) -> usize {
910
let x: usize = if bar % 5 == 0 {
1011
return 3;
1112
};
1213
//~^^^ ERROR if may be missing an else clause
14+
//~| ERROR mismatched types [E0308]
1315
x
1416
}
1517

@@ -18,6 +20,7 @@ fn foo3(bar: usize) -> usize {
1820
3
1921
}
2022
//~^^^ ERROR if may be missing an else clause
23+
//~| ERROR mismatched types [E0308]
2124
}
2225

2326
fn foo_let(bar: usize) -> usize {
@@ -45,4 +48,3 @@ fn foo3_let(bar: usize) -> usize {
4548
fn main() {
4649
let _ = foo(1);
4750
}
48-

Diff for: src/test/ui/if/if-without-else-as-fn-expr.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | | }
2525
= help: consider adding an `else` block that evaluates to the expected type
2626

2727
error[E0308]: mismatched types
28-
--> $DIR/if-without-else-as-fn-expr.rs:9:20
28+
--> $DIR/if-without-else-as-fn-expr.rs:10:20
2929
|
3030
LL | let x: usize = if bar % 5 == 0 {
3131
| ____________________^
@@ -37,7 +37,7 @@ LL | | };
3737
found type `()`
3838

3939
error[E0317]: if may be missing an else clause
40-
--> $DIR/if-without-else-as-fn-expr.rs:9:20
40+
--> $DIR/if-without-else-as-fn-expr.rs:10:20
4141
|
4242
LL | let x: usize = if bar % 5 == 0 {
4343
| _________-__________^
@@ -53,7 +53,7 @@ LL | | };
5353
= help: consider adding an `else` block that evaluates to the expected type
5454

5555
error[E0308]: mismatched types
56-
--> $DIR/if-without-else-as-fn-expr.rs:17:5
56+
--> $DIR/if-without-else-as-fn-expr.rs:19:5
5757
|
5858
LL | / if bar % 5 == 0 {
5959
LL | | 3
@@ -64,7 +64,7 @@ LL | | }
6464
found type `()`
6565

6666
error[E0317]: if may be missing an else clause
67-
--> $DIR/if-without-else-as-fn-expr.rs:17:5
67+
--> $DIR/if-without-else-as-fn-expr.rs:19:5
6868
|
6969
LL | fn foo3(bar: usize) -> usize {
7070
| ----- expected `usize` because of this return type
@@ -79,7 +79,7 @@ LL | | }
7979
= help: consider adding an `else` block that evaluates to the expected type
8080

8181
error[E0317]: if may be missing an else clause
82-
--> $DIR/if-without-else-as-fn-expr.rs:24:5
82+
--> $DIR/if-without-else-as-fn-expr.rs:27:5
8383
|
8484
LL | fn foo_let(bar: usize) -> usize {
8585
| ----- expected `usize` because of this return type
@@ -94,7 +94,7 @@ LL | | }
9494
= help: consider adding an `else` block that evaluates to the expected type
9595

9696
error[E0317]: if may be missing an else clause
97-
--> $DIR/if-without-else-as-fn-expr.rs:31:20
97+
--> $DIR/if-without-else-as-fn-expr.rs:34:20
9898
|
9999
LL | let x: usize = if let 0 = 1 {
100100
| _________-__________^
@@ -110,7 +110,7 @@ LL | | };
110110
= help: consider adding an `else` block that evaluates to the expected type
111111

112112
error[E0317]: if may be missing an else clause
113-
--> $DIR/if-without-else-as-fn-expr.rs:39:5
113+
--> $DIR/if-without-else-as-fn-expr.rs:42:5
114114
|
115115
LL | fn foo3_let(bar: usize) -> usize {
116116
| ----- expected `usize` because of this return type

Diff for: src/test/ui/issues/issue-50577.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ fn main() {
22
enum Foo {
33
Drop = assert_eq!(1, 1)
44
//~^ ERROR if may be missing an else clause
5+
//~| ERROR mismatched types [E0308]
56
}
67
}

0 commit comments

Comments
 (0)