Skip to content

Commit 039f70e

Browse files
committed
Add more test cases to tests/ui/issues/issue-92741.rs
1 parent 9cdc075 commit 039f70e

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

tests/ui/issues/issue-92741.rs

+10
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ fn foo() -> bool {
44
mut
55
if true { true } else { false }
66
}
7+
8+
fn bar() -> bool {
9+
& //~ ERROR 9:5: 10:40: mismatched types [E0308]
10+
mut if true { true } else { false }
11+
}
12+
13+
fn baz() -> bool {
14+
& mut //~ ERROR 14:5: 15:36: mismatched types [E0308]
15+
if true { true } else { false }
16+
}

tests/ui/issues/issue-92741.stderr

+31-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@ LL - &
1414
LL - mut
1515
|
1616

17-
error: aborting due to previous error
17+
error[E0308]: mismatched types
18+
--> $DIR/issue-92741.rs:9:5
19+
|
20+
LL | fn bar() -> bool {
21+
| ---- expected `bool` because of return type
22+
LL | / &
23+
LL | | mut if true { true } else { false }
24+
| |_______________________________________^ expected `bool`, found `&mut bool`
25+
|
26+
help: consider removing the borrow
27+
|
28+
LL - &
29+
LL - mut if true { true } else { false }
30+
LL + if true { true } else { false }
31+
|
32+
33+
error[E0308]: mismatched types
34+
--> $DIR/issue-92741.rs:14:5
35+
|
36+
LL | fn baz() -> bool {
37+
| ---- expected `bool` because of return type
38+
LL | / & mut
39+
LL | | if true { true } else { false }
40+
| |___________________________________^ expected `bool`, found `&mut bool`
41+
|
42+
help: consider removing the borrow
43+
|
44+
LL - & mut
45+
|
46+
47+
error: aborting due to 3 previous errors
1848

1949
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)